UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:34:39";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:36:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:06:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-28 09:06:06', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=2640
UPDATE programsettings SET companyname = 'الشاذلي للاضاءه الحديثه', address = ' العنوان :كفر بهيده بجوار المستشفي<br/> المرتجع خلال 3 اشهورمن تاريخ الفاتوره<br/>الا الاسلاك خلال 20يوم<br/>ممنوع رجوع الاسلاك والليد المفتوح', specializtion = '', phone = '01096879556-01091024885', faxnumber = '', email = 'mousa_maged@hotmail.com', website = '', logo = 'a5583ab9a3a85fbef9bfbbd46031c2d2.jpeg', roundnumbers = '1', saveprinting = '1', deptprinting = '1', printingpapersize = '0', userid = '1', showPreviousPrice = '0', parcode = '0', priceing = '0', lastprice = '0', searchvalue = '2',clientsearchvalue = '2', updateproductprice = '0', allowfinsldelete = '0', updateclientprice = '0', `partition` = 'D', taxcard = '123456789123', commercialregistration = '1234', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '1', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2026-09-28',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='57a85883346811cbf7076a51c5bd887a2e96bf2df777a95668d34a3537aceedfe3f238b684c96d789642405e6f69293dbb311716d957a5ac40fe5570cf297eaf',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='0' , date='1' , limitamount = '0' , measuringunit = '1' , print_amount = '0' , billid = '0' , precentages = '1' , realprice = '1' ,delegate_seller = '0' , storeserial = '1' ,clientfieldrequired ='0' , clientcodname='0' , colortype = '0' , nakdyOnly = '0' , nakdyKashf = '0' , discount_pres_direct = '0' , general_discount = '0' , sells_return = '0' ,scunitname ='0',vatValue = '0.00',syncstructure = '1',showPrevPrices = '0',isOpticProg='1',reportsPlusHours = '2' , showM5zon = '1',restaurantStoreId = '1',restuarantPrintTimeout = '8',sumSameProductForStore = '0', editAllPrice = '0', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='0',addclienttoproduct='0',closingcustomeraccount='0',serial2='',
                shownameE='0',showprocode='0',showpartnumber='0',showtype='0',showcompany='0',showweight='0',showorigin='0',showhscode='0',showexpire='0',showgrantduration='0',showonline='0',showminappear='0',showonlinecat='0',showsellpercentage='0',showbuydiscount='0',preparingStore='1',sellordername='0',showsearchfilter='0',unitPriceAtsalesreport='0',medExCat='0',laterNakdiClientId='0',headerPrint12Right='',headerPrint12Left='',halfPriceStart='0',allPriceStart='0',checkretsellclient='1',webApiId='0',noBillEditTillPay='0',showDataOfficialContract='0',showprice9='0',showprice10='0',showprice11='0',showprice12='0',showprice13='0',serial3='9aad922c8dc25742295df2779fde48ab62230719d569b9aa71bf6d5e0e08471c7dbda60d508155af60894a0ba3bbd86ffbee699027a409bcd9ca11e28a846cc5',associatedtags='0',commentClientChasis='0',dollarExType='64',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0'
                ,reviewRecords='',reviewRecordsLastDate='0000-00-00',showepayrestaurant='0',showSellAllPriceInStoreDetail='0' WHERE programsettingsid = '1';
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:36:12";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-28 09:06:12', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=2641
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:36:17";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:06:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:06:17', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2642
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:42:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:12:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:12:29', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2643
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:45:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:15:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-28 09:15:53', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2644
UPDATE productunit SET unitid = '1', productid = '196', productnumber = '1.00', productunitdate = '2026-09-15', userid = '1', conditions = '0',proUnitParcode='0019601',proUnitSellAllPrice='220',proUnitSellHalfPrice='220',proUnitSellUnitPrice ='245',proUnitBuyPrice='210',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '196';
UPDATE product SET productName = 'لفه ليد بروفايل ورم ', productDescription = '', productCatId = '20', productBuyPrice = '217.92', productSellAllPrice = '230', productSellUnitPrice = '245', productSellHalfPrice = '230', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00196',type ='0', expireDate = '0' , dailyentryId = '223',isService = '0',isOptic = '0',lastbuyprice = '210.00',lastbuyprice_withDiscount = '210',meanbuyprice = '210.00',meanbuyprice_withDiscount = '210' , productbuypricereal = '210' , buypricereal_precentage = '0' , buytotal_precentage = '4.76' , buyhalf_precentage = '4.76' , buypart_precentage = '16.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='210',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='210',meanbuyprice_withTax='210',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='210',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '196';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:47:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:17:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-28 09:17:15', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2645
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 ('06aba142c0c16f', '2026-09-28 09:15:56', '9', '155321.40', '175188.6', '0', '0', '34867.20',  '34867.20', '15000', '19867.2', '1', '2026-09-28 09:17:16', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=31
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 ('00196', '31', '20', '196', '160', '217.92', '34867.20', '0', '', '2026-09-28 09:17:16', '196','','','0','0','0','0','0',null,'217.92','34867.2','0','0','0','0','0','0','0','0','1'); -- id=109
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-28 09:15:56', 1, 196, 0, 0
                    , 217.92, 160, 0, 0, 1, '2026-09-28 09:17:16')
                ON DUPLICATE KEY UPDATE buyprice = 217.92,
                        buyQuantity =buyQuantity+160, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-28 09:17:16' ; -- id=109
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('196', '217.92', '160', '0', 'buyBillController.php', '109', '', '0', '0'); -- id=109
UPDATE product SET  productBuyPrice = "217.92" WHERE productId = 196 ;
UPDATE buybilldetail SET  quantitybefore = 54 WHERE buybilldetailid = 109 ;
UPDATE product SET productName = 'لفه ليد بروفايل ورم ', productDescription = '', productCatId = '20', productBuyPrice = '217.92', productSellAllPrice = '230.00', productSellUnitPrice = '245.00', productSellHalfPrice = '230.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00196',type ='0', expireDate = '0' , dailyentryId = '223',isService = '0',isOptic = '0',lastbuyprice = '217.92',lastbuyprice_withDiscount = '217.92',meanbuyprice = '215.92',meanbuyprice_withDiscount = '215.92' , productbuypricereal = '210.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.76' , buyhalf_precentage = '4.76' , buypart_precentage = '16.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='210',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='217.92',meanbuyprice_withTax='215.92',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='217.92',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '196';
UPDATE buybilldetail SET  lastbuyprice = 217.92 , meanbuyprice = 215.92, lastbuyprice_withDiscount = 217.92, meanbuyprice_withDiscount = 215.92
        , lastbuyprice_withTax = 217.92, meanbuyprice_withTax = 215.92, lastbuyprice_withDiscountAndTax = 217.92
                where buybilldetailid = 109;
UPDATE productunit SET proUnitBuyPrice  = 217.92 * productnumber WHERE productid = 196;
UPDATE storedetail SET  productquantity = '214', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('196', '1', '160', '0', '31', 'اضافة فاتورة مشتريات', 'buyBillController.php', '54', '214', '1', '2026-09-28 09:15:56','0','0'); -- id=2058
UPDATE supplier SET  suppliercurrentDebt = '175188.6',suppliercurrentDebtInCurrency= '175188.6' , userid = '1', supplierdate = '2026-09-28 09:17:16'   WHERE supplierid = '9';
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 ('9', '155321.40', '19867.2', '0', 'اضافة فاتورة مشتريات', '31', '175188.6', '2026-09-28 09:15:56', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','19867.2','1','155321.4','19867.2','175188.6','0',''); -- id=57
UPDATE save SET  savecurrentvalue = '-386044.04',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-371044.04','15000', '1', '1', 'اضافة فاتورة مشتريات', '31', '-386044.04', '2026-09-28 09:15:56', '1',  'buyBillController.php','0','','0'); -- id=158
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '34867.2', '34867.2', '2026-09-28', '1', '0', '0', '2026-09-28 09:17:17','اضافة فاتورة مشتريات رقم 31','1','0',null,'0','31','buyBillController.php?do=details&id=31'); -- id=1018
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1018', '382', '34867.2', '','0'); -- id=1018
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2429909.87', 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 ('1018', '432', '34867.2', '','0'); -- id=1018
UPDATE accountstree SET name = 'شركه باندا حساب نشات ', customName = 'شركه باندا حساب نشات ', customNameEn = 'شركه باندا حساب نشات ', nameEn = 'شركه باندا حساب نشات ', parent = '81', accountNature = '1', theValue = '190188.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 22:21:02' WHERE id = '432';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15000', '15000', '2026-09-28', '1', '0', '0', '2026-09-28 09:17:17','اضافة فاتورة مشتريات رقم 31 - سداد الفاتورة للمورد','1','0',null,'0','31','buyBillController.php?do=details&id=31'); -- id=1019
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1019', '432', '15000', '','0'); -- id=1019
UPDATE accountstree SET name = 'شركه باندا حساب نشات ', customName = 'شركه باندا حساب نشات ', customNameEn = 'شركه باندا حساب نشات ', nameEn = 'شركه باندا حساب نشات ', parent = '81', accountNature = '1', theValue = '175188.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 22:21:02' WHERE id = '432';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1019', '383', '15000', '','0'); -- id=1019
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-225962.49', 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='1018,1019' where buybillid=31;
COMMIT;
UPDATE product SET overAllAveragePrice = 217.92 WHERE productId = 196;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:47:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:17:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-28 09:17:18', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=31'); -- id=2646
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:47:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:17:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-28 09:17:30', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=2647
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 05:47:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:17:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-28 09:17:36', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=2648
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:01:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:31:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:31:31', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2649
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:05:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:35:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:35:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2650
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:08:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:38:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 09:38:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2651
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:08:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:38:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 09:38:56', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=2652
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','20','23','23','23','2026-09-28','0','1','0','','0','0','0','0','0','20','20','20','20','20','0','15','15','15','.','0','0','0','20','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','20','20','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','20','0','0','0','0','0','0','','','0','0','0','0'); -- id=525
UPDATE product SET productName = 'عازل صيني', productDescription = '', productCatId = '6', productBuyPrice = '20', productSellAllPrice = '23', productSellUnitPrice = '23', productSellHalfPrice = '23', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00525',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '20',lastbuyprice_withDiscount = '20',meanbuyprice = '20',meanbuyprice_withDiscount = '20' , productbuypricereal = '20' , buypricereal_precentage = '0' , buytotal_precentage = '15' , buyhalf_precentage = '15' , buypart_precentage = '15',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='20',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='20',meanbuyprice_withTax='20',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='20',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '525';
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', '525', '1.00', '2026-09-28', '1', '0','0052501','23','23','23','20','','0','0','0','0','0','0','0','0','0','0'); -- id=525
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('525', '1', '25', '1', '2026-09-28'); -- id=525
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '25', '0', '525', 'إضافة منتج', 'productController.php', '0', '25', '1', '2026-09-28','0','0'); -- id=2059
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (525, 1,'2026-09-28 09:38:58',1)
                ON DUPLICATE KEY UPDATE productid = 525, edited = 1, sysdate = '2026-09-28 09:38:58', userid = 1; -- id=653
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '500', '500', '2026-09-28', '1', '0', '0', '2026-09-28 09:38:58','إضافة منتج عازل صيني الكمية 25','1','0','0','0','525','productController.php?do=edit&id=525'); -- id=1020
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1020', '382', '500', '','0'); -- id=1020
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2430409.87', 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 ('1020', '121', '500', '','0'); -- id=1020
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1524257.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'عازل صيني', productDescription = '', productCatId = '6', productBuyPrice = '20.00', productSellAllPrice = '23.00', productSellUnitPrice = '23.00', productSellHalfPrice = '23.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00525',type ='0', expireDate = '0' , dailyentryId = '1020',isService = '0',isOptic = '0',lastbuyprice = '20',lastbuyprice_withDiscount = '20',meanbuyprice = '20',meanbuyprice_withDiscount = '20' , productbuypricereal = '20' , buypricereal_precentage = '0' , buytotal_precentage = '15' , buyhalf_precentage = '15' , buypart_precentage = '15',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='20',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='20',meanbuyprice_withTax='20',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='20',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '525';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:09:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:39:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 09:39:00', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2653
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:10:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:40:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:40:15', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2654

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aba17d4245ca
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 09:40:16', '06aba17d4245ca', '1', '0.00', '0', '0', '1', '2661.00', '2661', '2661', '0', '1', '2026-09-28 09:40:16', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','2661','0','','0','0','2661','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=148
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','اضافة فاتورة مبيعات','148', '0', '2026-09-28 09:40:16', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2661', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-28 09:40:16','0','0','',''); -- id=251
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2150','00242', '148', '10', '242', '1', '2600', '2600', '0', '', '1', '2026-09-28 09:40:17', '242', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2600','2600','0','','0','0.00','0','0','0','0'); -- id=1009
UPDATE sellbilldetail SET  lastbuyprice = 2150.00 , meanbuyprice = 2150.00, lastbuyprice_withDiscount = 2150.00, meanbuyprice_withDiscount = 2150.00
        , lastbuyprice_withTax = 2150, meanbuyprice_withTax = 2150, lastbuyprice_withDiscountAndTax = 2150
                where sellbilldetailid = 1009;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (242, '2026-09-28', 2600, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2600, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2600, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2600, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-28 09:40:17' WHERE storedetailid = '242';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('242', '1', '1', '1', '148', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-09-28 09:40:17','0','0'); -- id=2060
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '148', '14', '81', '2', '19', '38', '0', '', '1', '2026-09-28 09:40:17', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=1010
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 = 1010;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-09-28', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '518', userid = '1', storedetaildate = '2026-09-28 09:40:17' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '148', 'اضافة فاتورة مبيعات', 'sellbillController.php', '520', '518', '1', '2026-09-28 09:40:17','0','0'); -- id=2061
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('20','00525', '148', '6', '525', '1', '23', '23', '0', '', '1', '2026-09-28 09:40:17', '525', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=1011
UPDATE sellbilldetail SET  lastbuyprice = 20.00 , meanbuyprice = 20.00, lastbuyprice_withDiscount = 20.00, meanbuyprice_withDiscount = 20.00
        , lastbuyprice_withTax = 20, meanbuyprice_withTax = 20, lastbuyprice_withDiscountAndTax = 20
                where sellbilldetailid = 1011;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (525, '2026-09-28', 23, 20, 20
                    , 20, 20, 20, 20
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 20, 20, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+20
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 20, 20
                    , 20, 20, 20, 20
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 20, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+20
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-09-28 09:40:18' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '1', '1', '148', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '24', '1', '2026-09-28 09:40:18','0','0'); -- id=2062
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-383383.03125',  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 ('-386044.03125','2661', '0', '1', 'اضافة فاتورة مبيعات', '148', '-383383.03125', '2026-09-28 09:40:18', '1',  'sellbillController.php','1','','0'); -- id=159
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2661', '2661', '2026-09-28', '1', '0', '0', '2026-09-28 09:40:18','اضافة فاتورة مبيعات رقم 148','1','0',null,'0','148','sellbillController.php?do=showDetail&sellbillid=148'); -- id=1021
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1021', '383', '2661', '','0'); -- id=1021
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-223301.49', 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 ('1021', '143', '2661', '','0'); -- id=1021
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '487814.27', 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 ( '2206', '2206', '2026-09-28', '1', '0', '0', '2026-09-28 09:40:18','اضافة فاتورة مبيعات رقم 148 - صرف البضاعة من المخزن','1','0',null,'0','148','sellbillController.php?do=showDetail&sellbillid=148'); -- id=1022
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1022', '402', '2206', '','0'); -- id=1022
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '451914.8', 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 ('1022', '382', '2206', '','0'); -- id=1022
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2428203.87', 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='1021,0,1022' where sellbillid=148;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 2661, 2206, 2206
                    , 2206, 2206, 2206, 2206
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2206, 2206, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2661, sellCostBuyPrice =sellCostBuyPrice+2206
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2206, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2206
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2206, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2206
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2206
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2206
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2206
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2661, 2206, 2206
                    , 2206, 2206, 2206, 2206
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2206, 2206, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2661, sellCostBuyPrice =sellCostBuyPrice+2206
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2206, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2206
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2206, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2206
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2206
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2206
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2206
                        , returnSellVal = returnSellVal+0, 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, 2661, 2206, 2206
                    , 2206, 2206, 2206, 2206, 2206, 2206)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2661, netSellCostBuyPrice = netSellCostBuyPrice+2206
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2206
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2206
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2206
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2206
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2206
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2206
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2206;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aba17d4245ca and sellbillId = 148 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:10:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:40:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:40:19', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2655
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:10:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:40:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:40:54', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2656

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aba19e49f863
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 09:40:54', '06aba19e49f863', '1', '0.00', '0', '0', '1', '250.00', '250', '250', '0', '1', '2026-09-28 09:40:54', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','250','0','','0','0','250','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=149
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','اضافة فاتورة مبيعات','149', '0', '2026-09-28 09:40:55', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '250', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-28 09:40:54','0','0','',''); -- id=252
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('223','00162', '149', '22', '162', '1', '250', '250', '0', '', '1', '2026-09-28 09:40:55', '162', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','250','250','0','','0','0.00','0','0','0','0'); -- id=1012
UPDATE sellbilldetail SET  lastbuyprice = 223.00 , meanbuyprice = 223.00, lastbuyprice_withDiscount = 223.00, meanbuyprice_withDiscount = 223.00
        , lastbuyprice_withTax = 223, meanbuyprice_withTax = 223, lastbuyprice_withDiscountAndTax = 223
                where sellbilldetailid = 1012;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (162, '2026-09-28', 250, 223, 223
                    , 223, 223, 223, 223
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 223, 223, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+223
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+223, sellCostMeanBuyPrice = sellCostMeanBuyPrice+223
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+223, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+223
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+223
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+223
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+223
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 250, 223, 223
                    , 223, 223, 223, 223
                    , 0, 0, 0, 0
                    , 0, 0, 0, 223, 223, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+223
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+223, sellCostMeanBuyPrice = sellCostMeanBuyPrice+223
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+223, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+223
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+223
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+223
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+223
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-09-28 09:40:55' WHERE storedetailid = '162';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('162', '1', '1', '1', '149', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '15', '1', '2026-09-28 09:40:55','0','0'); -- id=2063
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-383133.03125',  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 ('-383383.03125','250', '0', '1', 'اضافة فاتورة مبيعات', '149', '-383133.03125', '2026-09-28 09:40:56', '1',  'sellbillController.php','1','','0'); -- id=160
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '250', '250', '2026-09-28', '1', '0', '0', '2026-09-28 09:40:56','اضافة فاتورة مبيعات رقم 149','1','0',null,'0','149','sellbillController.php?do=showDetail&sellbillid=149'); -- id=1023
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1023', '383', '250', '','0'); -- id=1023
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-223051.49', 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 ('1023', '143', '250', '','0'); -- id=1023
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '488064.27', 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 ( '223', '223', '2026-09-28', '1', '0', '0', '2026-09-28 09:40:56','اضافة فاتورة مبيعات رقم 149 - صرف البضاعة من المخزن','1','0',null,'0','149','sellbillController.php?do=showDetail&sellbillid=149'); -- id=1024
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1024', '402', '223', '','0'); -- id=1024
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '452137.8', 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 ('1024', '382', '223', '','0'); -- id=1024
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2427980.87', 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='1023,0,1024' where sellbillid=149;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 250, 223, 223
                    , 223, 223, 223, 223
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,223, 223, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+223
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+223, sellCostMeanBuyPrice = sellCostMeanBuyPrice+223
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+223, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+223
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+223
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+223
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+223
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 250, 223, 223
                    , 223, 223, 223, 223
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,223, 223, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+250, sellCostBuyPrice =sellCostBuyPrice+223
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+223, sellCostMeanBuyPrice = sellCostMeanBuyPrice+223
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+223, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+223
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+223
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+223
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+223
                        , returnSellVal = returnSellVal+0, 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, 250, 223, 223
                    , 223, 223, 223, 223, 223, 223)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+250, netSellCostBuyPrice = netSellCostBuyPrice+223
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+223
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+223
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+223
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+223
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+223
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+223
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+223;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aba19e49f863 and sellbillId = 149 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:10:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:40:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:40:57', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2657
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:11:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:41:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:41:08', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5&billtoret=149'); -- id=2658
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:11:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 09:41:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 09:41:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2659
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:38:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 10:08:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 10:08:09', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2660

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aba11ecee4ec
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(39,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 10:08:10', '06aba11ecee4ec', '39', '0.00', '53452.1', '0', '1', '53452.10', '53452.1', '0', '53452.1', '1', '2026-09-28 10:08:10', '', '1', '0', 'محمد عباس الطوخي', '1', '1', '3', '0', 'محمد عباس الطوخي', '1033' ,'0','','','','','-1','0','0','0','0','0','53452','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=150
UPDATE client SET  clientdebt = '53452.1', userid = '1' WHERE clientid = '39';
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 ('39','0.00','53452.1','0','اضافة فاتورة مبيعات','150', '53452.1', '2026-09-28 10:08:10', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '53452.1', '0', null, '0', null, null,'', '0','1','1','53452.1','1','2026-09-28 10:08:10','0','0','',''); -- id=253
UPDATE client SET  inUse = 0 where clientid = 39;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.75','00001', '150', '1', '1', '150', '54', '8100', '0', '', '1', '2026-09-28 10:08:10', '1', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54','8100','0','','0','0.00','0','0','0','0'); -- id=1013
UPDATE sellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where sellbilldetailid = 1013;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 8100, 7912.5, 7912.5
                    , 7912.5, 7912.5, 7912.5, 7912.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 150, 0, 7912.5, 7912.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8100, sellCostBuyPrice =sellCostBuyPrice+7912.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7912.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7912.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7912.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7912.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7912.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7912.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7912.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+150
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 8100, 7912.5, 7912.5
                    , 7912.5, 7912.5, 7912.5, 7912.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7912.5, 7912.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8100, sellCostBuyPrice =sellCostBuyPrice+7912.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7912.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7912.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7912.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7912.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7912.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7912.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7912.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 = '384', userid = '1', storedetaildate = '2026-09-28 10:08:11' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '150', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '534', '384', '1', '2026-09-28 10:08:11','0','0'); -- id=2064
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('221','00020', '150', '1', '20', '9', '230', '2070', '0', '', '1', '2026-09-28 10:08:11', '20', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','230','2070','0','','0','0.00','0','0','0','0'); -- id=1014
UPDATE sellbilldetail SET  lastbuyprice = 221.00 , meanbuyprice = 221.00, lastbuyprice_withDiscount = 221.00, meanbuyprice_withDiscount = 221.00
        , lastbuyprice_withTax = 221, meanbuyprice_withTax = 221, lastbuyprice_withDiscountAndTax = 221
                where sellbilldetailid = 1014;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (20, '2026-09-28', 2070, 1989, 1989
                    , 1989, 1989, 1989, 1989
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 1989, 1989, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2070, sellCostBuyPrice =sellCostBuyPrice+1989
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1989, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1989
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1989, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1989
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1989
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1989
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1989
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2070, 1989, 1989
                    , 1989, 1989, 1989, 1989
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1989, 1989, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2070, sellCostBuyPrice =sellCostBuyPrice+1989
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1989, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1989
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1989, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1989
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1989
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1989
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1989
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-28 10:08:11' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '9', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '1', '1', '2026-09-28 10:08:11','0','0'); -- id=2065
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 69;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237','00010', '150', '1', '10', '7', '246.5', '1725.5', '0', '', '1', '2026-09-28 10:08:11', '10', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','69-7,','1','1','0','0','246.5','1725.5','0','','0','0.00','0','0','0','0'); -- id=1015
UPDATE sellbilldetail SET  lastbuyprice = 237.00 , meanbuyprice = 237.00, lastbuyprice_withDiscount = 237.00, meanbuyprice_withDiscount = 237.00
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where sellbilldetailid = 1015;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-09-28', 1725.5, 1659, 1659
                    , 1659, 1659, 1659, 1659
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 1659, 1659, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1725.5, sellCostBuyPrice =sellCostBuyPrice+1659
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1659, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1659
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1659, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1659
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1659
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1659
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1659
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-28', 1725.5, 1659, 1659
                    , 1659, 1659, 1659, 1659
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1659, 1659, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1725.5, sellCostBuyPrice =sellCostBuyPrice+1659
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1659, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1659
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1659, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1659
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1659
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1659
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1659
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '79', userid = '1', storedetaildate = '2026-09-28 10:08:11' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '7', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '86', '79', '1', '2026-09-28 10:08:11','0','0'); -- id=2066
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 57;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('163','00015', '150', '1', '15', '7', '170', '1190', '0', '', '1', '2026-09-28 10:08:11', '15', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','57-7,','1','1','0','0','170','1190','0','','0','0.00','0','0','0','0'); -- id=1016
UPDATE sellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where sellbilldetailid = 1016;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-09-28', 1190, 1141, 1141
                    , 1141, 1141, 1141, 1141
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 1141, 1141, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1190, sellCostBuyPrice =sellCostBuyPrice+1141
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1141, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1141
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1141, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1141
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1141
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1141
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1141
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-28', 1190, 1141, 1141
                    , 1141, 1141, 1141, 1141
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1141, 1141, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1190, sellCostBuyPrice =sellCostBuyPrice+1141
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1141, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1141
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1141, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1141
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1141
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1141
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1141
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '97', userid = '1', storedetaildate = '2026-09-28 10:08:12' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '7', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '104', '97', '1', '2026-09-28 10:08:12','0','0'); -- id=2067
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 50;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1282','00202', '150', '6', '202', '1', '1850', '1850', '0', '', '1', '2026-09-28 10:08:12', '202', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','50-1,','1','1','0','0','1850','1850','0','','0','0.00','0','0','0','0'); -- id=1017
UPDATE sellbilldetail SET  lastbuyprice = 1282.00 , meanbuyprice = 1271.33, lastbuyprice_withDiscount = 1282.00, meanbuyprice_withDiscount = 1271.33
        , lastbuyprice_withTax = 1282, meanbuyprice_withTax = 1271.33, lastbuyprice_withDiscountAndTax = 1282
                where sellbilldetailid = 1017;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (202, '2026-09-28', 1850, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1850, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1850, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1850, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-09-28 10:08:12' WHERE storedetailid = '202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('202', '1', '1', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7', '6', '1', '2026-09-28 10:08:12','0','0'); -- id=2068
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '150', '6', '207', '8', '15', '120', '0', '', '1', '2026-09-28 10:08:12', '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=1018
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 = 1018;
 INSERT INTO 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-09-28', 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-09-28', 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 = '116', userid = '1', storedetaildate = '2026-09-28 10:08:12' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '124', '116', '1', '2026-09-28 10:08:12','0','0'); -- id=2069
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 62;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00006', '150', '1', '6', '20', '109', '2180', '0', '', '1', '2026-09-28 10:08:12', '6', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','62-20,','1','1','0','0','109','2180','0','','0','0.00','0','0','0','0'); -- id=1019
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1019;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '149', userid = '1', storedetaildate = '2026-09-28 10:08:13' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '20', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '169', '149', '1', '2026-09-28 10:08:13','0','0'); -- id=2070
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 63;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00011', '150', '1', '11', '20', '109', '2180', '0', '', '1', '2026-09-28 10:08:13', '11', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','63-20,','1','1','0','0','109','2180','0','','0','0.00','0','0','0','0'); -- id=1020
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1020;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '113', userid = '1', storedetaildate = '2026-09-28 10:08:13' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '20', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '133', '113', '1', '2026-09-28 10:08:13','0','0'); -- id=2071
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('156','00021', '150', '1', '21', '5', '163.62', '818.1', '0', '', '1', '2026-09-28 10:08:13', '21', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','163.62','818.1','0','','0','0.00','0','0','0','0'); -- id=1021
UPDATE sellbilldetail SET  lastbuyprice = 156.00 , meanbuyprice = 156.00, lastbuyprice_withDiscount = 156.00, meanbuyprice_withDiscount = 156.00
        , lastbuyprice_withTax = 156, meanbuyprice_withTax = 156, lastbuyprice_withDiscountAndTax = 156
                where sellbilldetailid = 1021;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (21, '2026-09-28', 818.1, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+818.1, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 818.1, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+818.1, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-28 10:08:13' WHERE storedetailid = '21';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('21', '1', '5', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '0', '1', '2026-09-28 10:08:13','0','0'); -- id=2072
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('60','00298', '150', '6', '298', '1', '75', '75', '0', '', '1', '2026-09-28 10:08:13', '298', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','75','75','0','','0','0.00','0','0','0','0'); -- id=1022
UPDATE sellbilldetail SET  lastbuyprice = 60.00 , meanbuyprice = 60.00, lastbuyprice_withDiscount = 60.00, meanbuyprice_withDiscount = 60.00
        , lastbuyprice_withTax = 60, meanbuyprice_withTax = 60, lastbuyprice_withDiscountAndTax = 60
                where sellbilldetailid = 1022;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (298, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-09-28 10:08:14' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '1', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '9', '1', '2026-09-28 10:08:14','0','0'); -- id=2073
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 67;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('63','00016', '150', '1', '16', '1', '67', '67', '0', '', '1', '2026-09-28 10:08:14', '16', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','67-1,','1','1','0','0','67','67','0','','0','0.00','0','0','0','0'); -- id=1023
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1023;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (16, '2026-09-28', 67, 63, 63
                    , 63, 63, 63, 63
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 63, 63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+67, sellCostBuyPrice =sellCostBuyPrice+63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+63, sellCostMeanBuyPrice = sellCostMeanBuyPrice+63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+63
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 67, 63, 63
                    , 63, 63, 63, 63
                    , 0, 0, 0, 0
                    , 0, 0, 0, 63, 63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+67, sellCostBuyPrice =sellCostBuyPrice+63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+63, sellCostMeanBuyPrice = sellCostMeanBuyPrice+63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+63
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-09-28 10:08:14' WHERE storedetailid = '16';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('16', '1', '1', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '125', '124', '1', '2026-09-28 10:08:14','0','0'); -- id=2074
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14.7','00136', '150', '21', '136', '155', '14.7', '2278.5', '0', '', '1', '2026-09-28 10:08:14', '136', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.7','2278.5','0','','0','0.00','0','0','0','0'); -- id=1024
UPDATE sellbilldetail SET  lastbuyprice = 14.70 , meanbuyprice = 14.70, lastbuyprice_withDiscount = 14.70, meanbuyprice_withDiscount = 14.70
        , lastbuyprice_withTax = 14.7, meanbuyprice_withTax = 14.7, lastbuyprice_withDiscountAndTax = 14.7
                where sellbilldetailid = 1024;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (136, '2026-09-28', 2278.5, 2278.5, 2278.5
                    , 2278.5, 2278.5, 2278.5, 2278.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 155, 0, 2278.5, 2278.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2278.5, sellCostBuyPrice =sellCostBuyPrice+2278.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2278.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2278.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2278.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2278.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2278.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2278.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2278.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+155
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2278.5, 2278.5, 2278.5
                    , 2278.5, 2278.5, 2278.5, 2278.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2278.5, 2278.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2278.5, sellCostBuyPrice =sellCostBuyPrice+2278.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2278.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2278.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2278.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2278.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2278.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2278.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2278.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 = '57', userid = '1', storedetaildate = '2026-09-28 10:08:14' WHERE storedetailid = '136';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('136', '1', '155', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '212', '57', '1', '2026-09-28 10:08:14','0','0'); -- id=2075
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('41.28','00187', '150', '20', '187', '155', '48', '7440', '0', '', '1', '2026-09-28 10:08:14', '187', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','7440','0','','0','0.00','0','0','0','0'); -- id=1025
UPDATE sellbilldetail SET  lastbuyprice = 41.28 , meanbuyprice = 41.28, lastbuyprice_withDiscount = 41.28, meanbuyprice_withDiscount = 41.28
        , lastbuyprice_withTax = 41.28, meanbuyprice_withTax = 41.28, lastbuyprice_withDiscountAndTax = 41.28
                where sellbilldetailid = 1025;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (187, '2026-09-28', 7440, 6398.4, 6398.4
                    , 6398.4, 6398.4, 6398.4, 6398.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 155, 0, 6398.4, 6398.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7440, sellCostBuyPrice =sellCostBuyPrice+6398.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6398.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6398.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6398.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6398.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6398.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6398.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6398.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+155
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 7440, 6398.4, 6398.4
                    , 6398.4, 6398.4, 6398.4, 6398.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6398.4, 6398.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7440, sellCostBuyPrice =sellCostBuyPrice+6398.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6398.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6398.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6398.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6398.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6398.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6398.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6398.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 = '356', userid = '1', storedetaildate = '2026-09-28 10:08:15' WHERE storedetailid = '187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('187', '1', '155', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '511', '356', '1', '2026-09-28 10:08:15','0','0'); -- id=2076
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00004', '150', '1', '4', '100', '35.75', '3575', '0', '', '1', '2026-09-28 10:08:15', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','35.75','3575','0','','0','0.00','0','0','0','0'); -- id=1026
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1026;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+100
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1619', userid = '1', storedetaildate = '2026-09-28 10:08:15' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '100', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1719', '1619', '1', '2026-09-28 10:08:15','0','0'); -- id=2077
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00003', '150', '1', '3', '100', '35.75', '3575', '0', '', '1', '2026-09-28 10:08:15', '3', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','35.75','3575','0','','0','0.00','0','0','0','0'); -- id=1027
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1027;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+100
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1371', userid = '1', storedetaildate = '2026-09-28 10:08:15' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '100', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1471', '1371', '1', '2026-09-28 10:08:15','0','0'); -- id=2078
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('63','00012', '150', '1', '12', '12', '66', '792', '0', '', '1', '2026-09-28 10:08:15', '12', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','66','792','0','','0','0.00','0','0','0','0'); -- id=1028
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1028;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-09-28', 792, 756, 756
                    , 756, 756, 756, 756
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 756, 756, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+792, sellCostBuyPrice =sellCostBuyPrice+756
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+756, sellCostMeanBuyPrice = sellCostMeanBuyPrice+756
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+756
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+756
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+756
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 792, 756, 756
                    , 756, 756, 756, 756
                    , 0, 0, 0, 0
                    , 0, 0, 0, 756, 756, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+792, sellCostBuyPrice =sellCostBuyPrice+756
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+756, sellCostMeanBuyPrice = sellCostMeanBuyPrice+756
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+756
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+756
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+756
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '79', userid = '1', storedetaildate = '2026-09-28 10:08:16' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '12', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '91', '79', '1', '2026-09-28 10:08:16','0','0'); -- id=2079
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '150', '14', '81', '10', '19', '190', '0', '', '1', '2026-09-28 10:08:16', '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=1029
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 = 1029;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-09-28', 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-09-28', 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 = '508', userid = '1', storedetaildate = '2026-09-28 10:08:16' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '518', '508', '1', '2026-09-28 10:08:16','0','0'); -- id=2080
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.55','00005', '150', '1', '5', '200', '10.95', '2190', '0', '', '1', '2026-09-28 10:08:16', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','2190','0','','0','0.00','0','0','0','0'); -- id=1030
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 1030;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 2190, 2110, 2110
                    , 2110, 2110, 2110, 2110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200, 0, 2110, 2110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2190, sellCostBuyPrice =sellCostBuyPrice+2110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+200
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2190, 2110, 2110
                    , 2110, 2110, 2110, 2110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2110, 2110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2190, sellCostBuyPrice =sellCostBuyPrice+2110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1130', userid = '1', storedetaildate = '2026-09-28 10:08:16' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '200', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1330', '1130', '1', '2026-09-28 10:08:16','0','0'); -- id=2081
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 17;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('69.5','00318', '150', '7', '318', '5', '75', '375', '0', '', '1', '2026-09-28 10:08:16', '318', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','17-5,','1','1','0','0','75','375','0','','0','0.00','0','0','0','0'); -- id=1031
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 1031;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-09-28', 375, 347.5, 347.5
                    , 343.9, 347.5, 343.9, 347.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 347.5, 343.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+375, sellCostBuyPrice =sellCostBuyPrice+347.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+347.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+347.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+347.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+347.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 375, 347.5, 347.5
                    , 343.9, 347.5, 343.9, 347.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 347.5, 343.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+375, sellCostBuyPrice =sellCostBuyPrice+347.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+347.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+347.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+347.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+347.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-09-28 10:08:17' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '5', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '65', '60', '1', '2026-09-28 10:08:17','0','0'); -- id=2082
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('252','00288', '150', '7', '288', '4', '295', '1180', '0', '', '1', '2026-09-28 10:08:17', '288', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','1180','0','','0','0.00','0','0','0','0'); -- id=1032
UPDATE sellbilldetail SET  lastbuyprice = 252.00 , meanbuyprice = 252.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 252, meanbuyprice_withTax = 252, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1032;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (288, '2026-09-28', 1180, 1008, 1008
                    , 1008, 1008, 1008, 1008
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1008, 1008, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1180, sellCostBuyPrice =sellCostBuyPrice+1008
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1008, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1008
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1008, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1008
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1008
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1008
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1008
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1180, 1008, 1008
                    , 1008, 1008, 1008, 1008
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1008, 1008, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1180, sellCostBuyPrice =sellCostBuyPrice+1008
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1008, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1008
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1008, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1008
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1008
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1008
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1008
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-28 10:08:17' WHERE storedetailid = '288';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('288', '1', '4', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '29', '25', '1', '2026-09-28 10:08:17','0','0'); -- id=2083
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('76.5','00320', '150', '7', '320', '7', '85', '595', '0', '', '1', '2026-09-28 10:08:17', '320', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','595','0','','0','0.00','0','0','0','0'); -- id=1033
UPDATE sellbilldetail SET  lastbuyprice = 76.50 , meanbuyprice = 76.50, lastbuyprice_withDiscount = 76.50, meanbuyprice_withDiscount = 76.50
        , lastbuyprice_withTax = 76.5, meanbuyprice_withTax = 76.5, lastbuyprice_withDiscountAndTax = 76.5
                where sellbilldetailid = 1033;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (320, '2026-09-28', 595, 535.5, 535.5
                    , 535.5, 535.5, 535.5, 535.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 535.5, 535.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+595, sellCostBuyPrice =sellCostBuyPrice+535.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+535.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+535.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+535.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+535.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+535.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+535.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+535.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+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-09-28', 595, 535.5, 535.5
                    , 535.5, 535.5, 535.5, 535.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 535.5, 535.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+595, sellCostBuyPrice =sellCostBuyPrice+535.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+535.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+535.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+535.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+535.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+535.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+535.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+535.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-09-28 10:08:17' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '7', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '18', '1', '2026-09-28 10:08:17','0','0'); -- id=2084
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '150', '1', '62', '7', '136', '952', '0', '', '1', '2026-09-28 10:08:17', '62', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','952','0','','0','0.00','0','0','0','0'); -- id=1034
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 = 1034;
 INSERT INTO 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-09-28', 952, 907.9, 907.9
                    , 907.9, 907.9, 907.9, 907.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 907.9, 907.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+952, sellCostBuyPrice =sellCostBuyPrice+907.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+907.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+907.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+907.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+907.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+907.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+907.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+907.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-28', 952, 907.9, 907.9
                    , 907.9, 907.9, 907.9, 907.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 907.9, 907.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+952, sellCostBuyPrice =sellCostBuyPrice+907.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+907.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+907.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+907.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+907.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+907.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+907.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+907.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-09-28 10:08:18' WHERE storedetailid = '62';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '1', '7', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '31', '24', '1', '2026-09-28 10:08:18','0','0'); -- id=2085
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('129.7','00061', '150', '1', '61', '6', '136', '816', '0', '', '1', '2026-09-28 10:08:18', '61', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','816','0','','0','0.00','0','0','0','0'); -- id=1035
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 = 1035;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (61, '2026-09-28', 816, 778.2, 778.2
                    , 778.2, 778.2, 778.2, 778.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 778.2, 778.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+816, sellCostBuyPrice =sellCostBuyPrice+778.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+778.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+778.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+778.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+778.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+778.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+778.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+778.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+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 816, 778.2, 778.2
                    , 778.2, 778.2, 778.2, 778.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 778.2, 778.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+816, sellCostBuyPrice =sellCostBuyPrice+778.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+778.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+778.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+778.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+778.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+778.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+778.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+778.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 = '54', userid = '1', storedetaildate = '2026-09-28 10:08:18' WHERE storedetailid = '61';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('61', '1', '6', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '54', '1', '2026-09-28 10:08:18','0','0'); -- id=2086
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '150', '1', '59', '15', '136', '2040', '0', '', '1', '2026-09-28 10:08:18', '59', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','2040','0','','0','0.00','0','0','0','0'); -- id=1036
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 = 1036;
 INSERT INTO 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-09-28', 2040, 1945.5, 1945.5
                    , 1945.5, 1945.5, 1945.5, 1945.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 1945.5, 1945.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1945.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1945.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1945.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1945.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1945.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1945.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1945.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1945.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2040, 1945.5, 1945.5
                    , 1945.5, 1945.5, 1945.5, 1945.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1945.5, 1945.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1945.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1945.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1945.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1945.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1945.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1945.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1945.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1945.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 = '162', userid = '1', storedetaildate = '2026-09-28 10:08:18' WHERE storedetailid = '59';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('59', '1', '15', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '177', '162', '1', '2026-09-28 10:08:18','0','0'); -- id=2087
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00060', '150', '1', '60', '8', '136', '1088', '0', '', '1', '2026-09-28 10:08:18', '60', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','1088','0','','0','0.00','0','0','0','0'); -- id=1037
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 = 1037;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (60, '2026-09-28', 1088, 1037.6, 1037.6
                    , 1037.6, 1037.6, 1037.6, 1037.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1037.6, 1037.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1088, sellCostBuyPrice =sellCostBuyPrice+1037.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1037.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1037.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1037.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1037.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1037.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1037.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1037.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+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-09-28', 1088, 1037.6, 1037.6
                    , 1037.6, 1037.6, 1037.6, 1037.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1037.6, 1037.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1088, sellCostBuyPrice =sellCostBuyPrice+1037.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1037.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1037.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1037.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1037.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1037.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1037.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1037.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 = '48', userid = '1', storedetaildate = '2026-09-28 10:08:19' WHERE storedetailid = '60';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('60', '1', '8', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '48', '1', '2026-09-28 10:08:19','0','0'); -- id=2088
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '150', '1', '9', '10', '319', '3190', '0', '', '1', '2026-09-28 10:08:19', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','71-10,','1','1','0','0','319','3190','0','','0','0.00','0','0','0','0'); -- id=1038
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 = 1038;
 INSERT INTO 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-09-28', 3190, 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+3190, 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-09-28', 3190, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3190, 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 = '56', userid = '1', storedetaildate = '2026-09-28 10:08:19' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '10', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66', '56', '1', '2026-09-28 10:08:19','0','0'); -- id=2089
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','00283', '150', '22', '283', '5', '335', '1675', '0', '', '1', '2026-09-28 10:08:19', '283', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','335','1675','0','','0','0.00','0','0','0','0'); -- id=1039
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1039;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (283, '2026-09-28', 1675, 1375, 1375
                    , 1375, 1375, 1375, 1375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1375, 1375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1675, sellCostBuyPrice =sellCostBuyPrice+1375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1675, 1375, 1375
                    , 1375, 1375, 1375, 1375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1375, 1375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1675, sellCostBuyPrice =sellCostBuyPrice+1375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-28 10:08:19' WHERE storedetailid = '283';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '1', '5', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '3', '1', '2026-09-28 10:08:19','0','0'); -- id=2090
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('137','00427', '150', '8', '427', '5', '225', '1125', '0', '', '1', '2026-09-28 10:08:19', '427', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','225','1125','0','','0','0.00','0','0','0','0'); -- id=1040
UPDATE sellbilldetail SET  lastbuyprice = 137.00 , meanbuyprice = 137.00, lastbuyprice_withDiscount = 137.00, meanbuyprice_withDiscount = 137.00
        , lastbuyprice_withTax = 137, meanbuyprice_withTax = 137, lastbuyprice_withDiscountAndTax = 137
                where sellbilldetailid = 1040;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (427, '2026-09-28', 1125, 685, 685
                    , 685, 685, 685, 685
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 685, 685, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1125, sellCostBuyPrice =sellCostBuyPrice+685
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+685, sellCostMeanBuyPrice = sellCostMeanBuyPrice+685
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+685, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+685
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+685
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+685
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+685
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1125, 685, 685
                    , 685, 685, 685, 685
                    , 0, 0, 0, 0
                    , 0, 0, 0, 685, 685, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1125, sellCostBuyPrice =sellCostBuyPrice+685
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+685, sellCostMeanBuyPrice = sellCostMeanBuyPrice+685
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+685, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+685
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+685
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+685
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+685
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-28 10:08:20' WHERE storedetailid = '427';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('427', '1', '5', '1', '150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '45', '1', '2026-09-28 10:08:20','0','0'); -- id=2091
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '53452.1', '53452.1', '2026-09-28', '1', '0', '0', '2026-09-28 10:08:20','اضافة فاتورة مبيعات رقم 150','1','0',null,'0','150','sellbillController.php?do=showDetail&sellbillid=150'); -- id=1025
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1025', '471', '53452.1', '','0'); -- id=1025
UPDATE accountstree SET name = 'محمد عباس الطوخي', customName = 'محمد عباس الطوخي', customNameEn = 'محمد عباس الطوخي', nameEn = 'محمد عباس الطوخي', parent = '58', accountNature = '0', theValue = '53452.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 19:10:39' WHERE id = '471';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1025', '143', '53452.1', '','0'); -- id=1025
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '541516.37', 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 ( '49537.6', '49537.6', '2026-09-28', '1', '0', '0', '2026-09-28 10:08:20','اضافة فاتورة مبيعات رقم 150 - صرف البضاعة من المخزن','1','0',null,'0','150','sellbillController.php?do=showDetail&sellbillid=150'); -- id=1026
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1026', '402', '49537.6', '','0'); -- id=1026
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '501675.4', 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 ('1026', '382', '49537.6', '','0'); -- id=1026
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2378443.27', 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='1025,0,1026' where sellbillid=150;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 53452.1, 49537.6, 49537.6
                    , 49523.33, 49537.6, 49523.33, 49537.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,49537.6, 49523.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+53452.1, sellCostBuyPrice =sellCostBuyPrice+49537.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+49537.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+49523.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+49537.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+49523.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+49537.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+49537.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+49523.33
                        , returnSellVal = returnSellVal+0, 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 (39, '2026-09-28', 53452.1, 49537.6, 49537.6
                    , 49523.33, 49537.6, 49523.33, 49537.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,49537.6, 49523.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+53452.1, sellCostBuyPrice =sellCostBuyPrice+49537.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+49537.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+49523.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+49537.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+49523.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+49537.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+49537.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+49523.33
                        , returnSellVal = returnSellVal+0, 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, 53452.1, 49537.6, 49537.6
                    , 49523.33, 49537.6, 49523.33, 49537.6, 49537.6, 49523.33)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+53452.1, netSellCostBuyPrice = netSellCostBuyPrice+49537.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+49537.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+49523.33
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+49537.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+49523.33
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+49537.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+49537.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+49523.33;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aba11ecee4ec and sellbillId = 150 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 06:38:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 10:08:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 10:08:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2661
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 07:30:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:00:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 11:00:42', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2662
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 07:32:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:02:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 11:02:38', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=2663
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 ملي الفؤاد ','','10','40','43','44','43','2026-09-28','0','1','0','','0','0','0','0','0','40','40','40','40','40','0','7.5','7.5','10','.','0','0','0','40','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','40','40','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','40','0','0','0','0','0','0','','','0','0','0','0'); -- id=526
UPDATE product SET productName = 'متر سلك 6 ملي الفؤاد ', productDescription = '', productCatId = '10', productBuyPrice = '40', productSellAllPrice = '43', productSellUnitPrice = '44', productSellHalfPrice = '43', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00526',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '40',lastbuyprice_withDiscount = '40',meanbuyprice = '40',meanbuyprice_withDiscount = '40' , productbuypricereal = '40' , buypricereal_precentage = '0' , buytotal_precentage = '7.5' , buyhalf_precentage = '7.5' , buypart_precentage = '10',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='40',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='40',meanbuyprice_withTax='40',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='40',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '526';
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', '526', '1.00', '2026-09-28', '1', '0','0052601','43','43','44','40','','0','0','0','0','0','0','0','0','0','0'); -- id=526
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('526', '1', '112', '1', '2026-09-28'); -- id=526
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('526', '1', '112', '0', '526', 'إضافة منتج', 'productController.php', '0', '112', '1', '2026-09-28','0','0'); -- id=2092
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (526, 1,'2026-09-28 11:02:39',1)
                ON DUPLICATE KEY UPDATE productid = 526, edited = 1, sysdate = '2026-09-28 11:02:39', userid = 1; -- id=654
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4480', '4480', '2026-09-28', '1', '0', '0', '2026-09-28 11:02:39','إضافة منتج متر سلك 6 ملي الفؤاد  الكمية 112','1','0','0','0','526','productController.php?do=edit&id=526'); -- id=1027
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1027', '382', '4480', '','0'); -- id=1027
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2382923.27', 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 ('1027', '121', '4480', '','0'); -- id=1027
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1528737.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'متر سلك 6 ملي الفؤاد ', productDescription = '', productCatId = '10', productBuyPrice = '40.00', productSellAllPrice = '43.00', productSellUnitPrice = '44.00', productSellHalfPrice = '43.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00526',type ='0', expireDate = '0' , dailyentryId = '1027',isService = '0',isOptic = '0',lastbuyprice = '40',lastbuyprice_withDiscount = '40',meanbuyprice = '40',meanbuyprice_withDiscount = '40' , productbuypricereal = '40' , buypricereal_precentage = '0' , buytotal_precentage = '7.5' , buyhalf_precentage = '7.5' , buypart_precentage = '10',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='40',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='40',meanbuyprice_withTax='40',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='40',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '526';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 07:32:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:02:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 11:02:42', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2664
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 07:41:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:11:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 11:11:06', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2665

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aba2076c5209
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 11:11:07', '06aba2076c5209', '1', '0.00', '0', '0', '1', '22466.00', '22466', '22466', '0', '1', '2026-09-28 11:11:07', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '79' ,'0','','','','','-1','0','0','0','0','0','22466','0','','0','0','22466','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=151
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','اضافة فاتورة مبيعات','151', '0', '2026-09-28 11:11:07', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '22466', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-28 11:11:07','0','0','',''); -- id=254
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('610','00213', '151', '13', '213', '1', '615', '615', '0', '', '1', '2026-09-28 11:11:07', '213', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','615','615','0','','0','0.00','0','0','0','0'); -- id=1041
UPDATE sellbilldetail SET  lastbuyprice = 610.00 , meanbuyprice = 610.00, lastbuyprice_withDiscount = 610.00, meanbuyprice_withDiscount = 610.00
        , lastbuyprice_withTax = 610, meanbuyprice_withTax = 610, lastbuyprice_withDiscountAndTax = 610
                where sellbilldetailid = 1041;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (213, '2026-09-28', 615, 610, 610
                    , 610, 610, 610, 610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 610, 610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+615, sellCostBuyPrice =sellCostBuyPrice+610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 615, 610, 610
                    , 610, 610, 610, 610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 610, 610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+615, sellCostBuyPrice =sellCostBuyPrice+610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-28 11:11:08' WHERE storedetailid = '213';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('213', '1', '1', '1', '151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-09-28 11:11:08','0','0'); -- id=2093
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '151', '12', '82', '10', '34', '340', '0', '', '1', '2026-09-28 11:11:08', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-10,','1','1','0','0','34','340','0','','0','0.00','0','0','0','0'); -- id=1042
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 = 1042;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-09-28', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 340, 308, 308
                    , 308, 308, 308, 308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 308, 308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '333', userid = '1', storedetaildate = '2026-09-28 11:11:08' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '10', '1', '151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '343', '333', '1', '2026-09-28 11:11:08','0','0'); -- id=2094
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '151', '10', '208', '6', '1240', '7440', '0', '', '1', '2026-09-28 11:11:08', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1240','7440','0','','0','0.00','0','0','0','0'); -- id=1043
UPDATE sellbilldetail SET  lastbuyprice = 1020.00 , meanbuyprice = 1020.00, lastbuyprice_withDiscount = 1020.00, meanbuyprice_withDiscount = 1020.00
        , lastbuyprice_withTax = 1020, meanbuyprice_withTax = 1020, lastbuyprice_withDiscountAndTax = 1020
                where sellbilldetailid = 1043;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 7440, 6120, 6120
                    , 6120, 6120, 6120, 6120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 6120, 6120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7440, sellCostBuyPrice =sellCostBuyPrice+6120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 7440, 6120, 6120
                    , 6120, 6120, 6120, 6120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6120, 6120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7440, sellCostBuyPrice =sellCostBuyPrice+6120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-09-28 11:11:08' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '6', '1', '151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '34', '1', '2026-09-28 11:11:08','0','0'); -- id=2095
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2000','00251', '151', '10', '251', '5', '2230', '11150', '0', '', '1', '2026-09-28 11:11:08', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2230','11150','0','','0','0.00','0','0','0','0'); -- id=1044
UPDATE sellbilldetail SET  lastbuyprice = 2000.00 , meanbuyprice = 2000.00, lastbuyprice_withDiscount = 2000.00, meanbuyprice_withDiscount = 2000.00
        , lastbuyprice_withTax = 2000, meanbuyprice_withTax = 2000, lastbuyprice_withDiscountAndTax = 2000
                where sellbilldetailid = 1044;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-09-28', 11150, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11150, sellCostBuyPrice =sellCostBuyPrice+10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 11150, 10000, 10000
                    , 10000, 10000, 10000, 10000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10000, 10000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11150, sellCostBuyPrice =sellCostBuyPrice+10000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-09-28 11:11:09' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '5', '1', '151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '43', '1', '2026-09-28 11:11:09','0','0'); -- id=2096
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00060', '151', '1', '60', '5', '133', '665', '0', '', '1', '2026-09-28 11:11:09', '60', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','133','665','0','','0','0.00','0','0','0','0'); -- id=1045
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 = 1045;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (60, '2026-09-28', 665, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+665, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 665, 648.5, 648.5
                    , 648.5, 648.5, 648.5, 648.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 648.5, 648.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+665, sellCostBuyPrice =sellCostBuyPrice+648.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+648.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+648.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+648.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+648.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '1', storedetaildate = '2026-09-28 11:11:09' WHERE storedetailid = '60';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('60', '1', '5', '1', '151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '43', '1', '2026-09-28 11:11:09','0','0'); -- id=2097
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 5;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('25.7','00092', '151', '18', '92', '2', '28', '56', '0', '', '1', '2026-09-28 11:11:09', '92', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','5-2,','1','1','0','0','28','56','0','','0','0.00','0','0','0','0'); -- id=1046
UPDATE sellbilldetail SET  lastbuyprice = 25.70 , meanbuyprice = 25.70, lastbuyprice_withDiscount = 25.70, meanbuyprice_withDiscount = 25.70
        , lastbuyprice_withTax = 25.7, meanbuyprice_withTax = 25.7, lastbuyprice_withDiscountAndTax = 25.7
                where sellbilldetailid = 1046;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (92, '2026-09-28', 56, 51.4, 51.4
                    , 51.4, 51.4, 51.4, 51.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 51.4, 51.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+51.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+51.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+51.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+51.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+51.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+51.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+51.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+51.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-09-28', 56, 51.4, 51.4
                    , 51.4, 51.4, 51.4, 51.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 51.4, 51.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+51.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+51.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+51.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+51.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+51.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+51.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+51.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+51.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 = '51', userid = '1', storedetaildate = '2026-09-28 11:11:09' WHERE storedetailid = '92';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('92', '1', '2', '1', '151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '53', '51', '1', '2026-09-28 11:11:09','0','0'); -- id=2098
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('40','00526', '151', '10', '526', '50', '44', '2200', '0', '', '1', '2026-09-28 11:11:09', '526', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','44','2200','0','','0','0.00','0','0','0','0'); -- id=1047
UPDATE sellbilldetail SET  lastbuyprice = 40.00 , meanbuyprice = 40.00, lastbuyprice_withDiscount = 40.00, meanbuyprice_withDiscount = 40.00
        , lastbuyprice_withTax = 40, meanbuyprice_withTax = 40, lastbuyprice_withDiscountAndTax = 40
                where sellbilldetailid = 1047;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (526, '2026-09-28', 2200, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2200, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-28', 2200, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2200, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2026-09-28 11:11:10' WHERE storedetailid = '526';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('526', '1', '50', '1', '151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112', '62', '1', '2026-09-28 11:11:10','0','0'); -- id=2099
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-360667.03125',  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 ('-383133.03125','22466', '0', '1', 'اضافة فاتورة مبيعات', '151', '-360667.03125', '2026-09-28 11:11:10', '1',  'sellbillController.php','1','','0'); -- id=161
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22466', '22466', '2026-09-28', '1', '0', '0', '2026-09-28 11:11:10','اضافة فاتورة مبيعات رقم 151','1','0',null,'0','151','sellbillController.php?do=showDetail&sellbillid=151'); -- id=1028
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1028', '383', '22466', '','0'); -- id=1028
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-200585.49', 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 ('1028', '143', '22466', '','0'); -- id=1028
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '563982.37', 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 ( '19737.9', '19737.9', '2026-09-28', '1', '0', '0', '2026-09-28 11:11:10','اضافة فاتورة مبيعات رقم 151 - صرف البضاعة من المخزن','1','0',null,'0','151','sellbillController.php?do=showDetail&sellbillid=151'); -- id=1029
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1029', '402', '19737.9', '','0'); -- id=1029
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '521413.3', 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 ('1029', '382', '19737.9', '','0'); -- id=1029
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2363185.37', 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='1028,0,1029' where sellbillid=151;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 22466, 19737.9, 19737.9
                    , 19737.9, 19737.9, 19737.9, 19737.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19737.9, 19737.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22466, sellCostBuyPrice =sellCostBuyPrice+19737.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19737.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19737.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19737.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19737.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19737.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19737.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19737.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 22466, 19737.9, 19737.9
                    , 19737.9, 19737.9, 19737.9, 19737.9
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19737.9, 19737.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22466, sellCostBuyPrice =sellCostBuyPrice+19737.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19737.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19737.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19737.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19737.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19737.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19737.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19737.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 22466, 19737.9, 19737.9
                    , 19737.9, 19737.9, 19737.9, 19737.9, 19737.9, 19737.9)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+22466, netSellCostBuyPrice = netSellCostBuyPrice+19737.9
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+19737.9
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+19737.9
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+19737.9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+19737.9
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+19737.9
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+19737.9
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+19737.9;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aba2076c5209 and sellbillId = 151 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 07:41:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:11:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 11:11:11', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2666
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:03:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:33:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-28 11:33:33', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2667
UPDATE productunit SET unitid = '1', productid = '208', productnumber = '1.00', productunitdate = '2026-09-15', userid = '1', conditions = '0',proUnitParcode='0020801',proUnitSellAllPrice='1130',proUnitSellHalfPrice='1130',proUnitSellUnitPrice ='1210',proUnitBuyPrice='1020',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '208';
UPDATE product SET productName = 'لفه سلك 1.5 الفؤاد 100 متر ', productDescription = '', productCatId = '10', productBuyPrice = '1040', productSellAllPrice = '1165', productSellUnitPrice = '1230', productSellHalfPrice = '1165', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00208',type ='0', expireDate = '0' , dailyentryId = '235',isService = '0',isOptic = '0',lastbuyprice = '1020.00',lastbuyprice_withDiscount = '1020',meanbuyprice = '1020.00',meanbuyprice_withDiscount = '1020' , productbuypricereal = '1020' , buypricereal_precentage = '0' , buytotal_precentage = '10.78' , buyhalf_precentage = '10.78' , buypart_precentage = '18.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1020',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='1020',meanbuyprice_withTax='1020',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='1020',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '208';
UPDATE productunit SET unitid = '1', productid = '249', productnumber = '1.00', productunitdate = '2026-09-15', userid = '1', conditions = '0',proUnitParcode='0024901',proUnitSellAllPrice='790',proUnitSellHalfPrice='790',proUnitSellUnitPrice ='810',proUnitBuyPrice='730',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '249';
UPDATE product SET productName = 'لفه سلك 1 ملي الفؤاد 100 متر ', productDescription = '', productCatId = '10', productBuyPrice = '650', productSellAllPrice = '745', productSellUnitPrice = '790', productSellHalfPrice = '745', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00249',type ='0', expireDate = '0' , dailyentryId = '297',isService = '0',isOptic = '0',lastbuyprice = '730.00',lastbuyprice_withDiscount = '730',meanbuyprice = '730.00',meanbuyprice_withDiscount = '730' , productbuypricereal = '730' , buypricereal_precentage = '0' , buytotal_precentage = '8.22' , buyhalf_precentage = '8.22' , buypart_precentage = '10.96',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='730',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='730',meanbuyprice_withTax='730',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='730',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '249';
UPDATE productunit SET unitid = '1', productid = '254', productnumber = '1.00', productunitdate = '2026-09-15', userid = '1', conditions = '0',proUnitParcode='0025401',proUnitSellAllPrice='6950',proUnitSellHalfPrice='6950',proUnitSellUnitPrice ='7150',proUnitBuyPrice='6300',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '254';
UPDATE product SET productName = 'لفه سلك 10 ملي شعر الفؤاد 100 متر ', productDescription = '', productCatId = '10', productBuyPrice = '6750', productSellAllPrice = '7050', productSellUnitPrice = '7250', productSellHalfPrice = '7050', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00254',type ='0', expireDate = '0' , dailyentryId = '302',isService = '0',isOptic = '0',lastbuyprice = '6300.00',lastbuyprice_withDiscount = '6300',meanbuyprice = '6300.00',meanbuyprice_withDiscount = '6300' , productbuypricereal = '6300' , buypricereal_precentage = '0' , buytotal_precentage = '10.32' , buyhalf_precentage = '10.32' , buypart_precentage = '13.49',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='6300',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='6300',meanbuyprice_withTax='6300',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='6300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '254';
UPDATE productunit SET unitid = '1', productid = '230', productnumber = '1.00', productunitdate = '2026-09-15', userid = '1', conditions = '0',proUnitParcode='0023001',proUnitSellAllPrice='1410',proUnitSellHalfPrice='1410',proUnitSellUnitPrice ='1520',proUnitBuyPrice='1320',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '230';
UPDATE product SET productName = 'لفه سلك 2 ملي سويدي', productDescription = '', productCatId = '10', productBuyPrice = '1350', productSellAllPrice = '1450', productSellUnitPrice = '1520', productSellHalfPrice = '1450', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00230',type ='0', expireDate = '0' , dailyentryId = '273',isService = '0',isOptic = '0',lastbuyprice = '1320.00',lastbuyprice_withDiscount = '1320',meanbuyprice = '1320.00',meanbuyprice_withDiscount = '1320' , productbuypricereal = '1320' , buypricereal_precentage = '0' , buytotal_precentage = '6.82' , buyhalf_precentage = '6.82' , buypart_precentage = '15.15',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1320',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='1320',meanbuyprice_withTax='1320',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='1320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '230';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:09:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:39:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-28 11:39:50', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2668
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 ('06aba346db1a52', '2026-09-28 11:33:33', '7', '85000.00', '123000', '0', '0', '143029.00',  '143029.00', '105029', '38000', '1', '2026-09-28 11:39:50', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=32
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 ('00208', '32', '10', '208', '41.55', '1040', '43212.00', '0', '', '2026-09-28 11:39:50', '208','','','0','0','0','0','0',null,'1040','43212','0','0','0','0','0','0','0','0','1'); -- id=110
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-28 11:33:33', 1, 208, 0, 0
                    , 1040, 41.55, 0, 0, 1, '2026-09-28 11:39:51')
                ON DUPLICATE KEY UPDATE buyprice = 1040,
                        buyQuantity =buyQuantity+41.55, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-28 11:39:51' ; -- id=110
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('208', '1040', '41.55', '0', 'buyBillController.php', '110', '', '0', '0'); -- id=110
UPDATE product SET  productBuyPrice = "1040" WHERE productId = 208 ;
UPDATE buybilldetail SET  quantitybefore = 34 WHERE buybilldetailid = 110 ;
UPDATE product SET productName = 'لفه سلك 1.5 الفؤاد 100 متر ', productDescription = '', productCatId = '10', productBuyPrice = '1040.00', productSellAllPrice = '1165.00', productSellUnitPrice = '1230.00', productSellHalfPrice = '1165.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00208',type ='0', expireDate = '0' , dailyentryId = '235',isService = '0',isOptic = '0',lastbuyprice = '1040',lastbuyprice_withDiscount = '1040',meanbuyprice = '1031',meanbuyprice_withDiscount = '1031' , productbuypricereal = '1020.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '10.78' , buyhalf_precentage = '10.78' , buypart_precentage = '18.63',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1020',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='1040',meanbuyprice_withTax='1031',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='1040',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '208';
UPDATE buybilldetail SET  lastbuyprice = 1040 , meanbuyprice = 1031, lastbuyprice_withDiscount = 1040, meanbuyprice_withDiscount = 1031
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where buybilldetailid = 110;
UPDATE productunit SET proUnitBuyPrice  = 1040 * productnumber WHERE productid = 208;
UPDATE storedetail SET  productquantity = '75.55', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '41.55', '0', '32', 'اضافة فاتورة مشتريات', 'buyBillController.php', '34', '75.55', '1', '2026-09-28 11:33:33','0','0'); -- id=2100
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 ('00249', '32', '10', '249', '41.85', '650', '27202.50', '0', '', '2026-09-28 11:39:50', '249','','','0','0','0','0','0',null,'650','27202.5','0','0','0','0','0','0','0','0','1'); -- id=111
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-28 11:33:33', 1, 249, 0, 0
                    , 650, 41.85, 0, 0, 1, '2026-09-28 11:39:52')
                ON DUPLICATE KEY UPDATE buyprice = 650,
                        buyQuantity =buyQuantity+41.85, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-28 11:39:52' ; -- id=111
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('249', '650', '41.85', '0', 'buyBillController.php', '111', '', '0', '0'); -- id=111
UPDATE product SET  productBuyPrice = "650" WHERE productId = 249 ;
UPDATE buybilldetail SET  quantitybefore = 8 WHERE buybilldetailid = 111 ;
UPDATE product SET productName = 'لفه سلك 1 ملي الفؤاد 100 متر ', productDescription = '', productCatId = '10', productBuyPrice = '650.00', productSellAllPrice = '745.00', productSellUnitPrice = '790.00', productSellHalfPrice = '745.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00249',type ='0', expireDate = '0' , dailyentryId = '297',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '662.84',meanbuyprice_withDiscount = '662.84' , productbuypricereal = '730.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.22' , buyhalf_precentage = '8.22' , buypart_precentage = '10.96',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='730',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='650',meanbuyprice_withTax='662.84',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='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '249';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 662.84, lastbuyprice_withDiscount = 650, meanbuyprice_withDiscount = 662.84
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 662.84, lastbuyprice_withDiscountAndTax = 650
                where buybilldetailid = 111;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 249;
UPDATE storedetail SET  productquantity = '49.85', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '249';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('249', '1', '41.85', '0', '32', 'اضافة فاتورة مشتريات', 'buyBillController.php', '8', '49.85', '1', '2026-09-28 11:33:33','0','0'); -- id=2101
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 ('00254', '32', '10', '254', '4.15', '6750', '28012.50', '0', '', '2026-09-28 11:39:50', '254','','','0','0','0','0','0',null,'6750','28012.5','0','0','0','0','0','0','0','0','1'); -- id=112
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-28 11:33:33', 1, 254, 0, 0
                    , 6750, 4.15, 0, 0, 1, '2026-09-28 11:39:52')
                ON DUPLICATE KEY UPDATE buyprice = 6750,
                        buyQuantity =buyQuantity+4.15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-28 11:39:52' ; -- id=112
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('254', '6750', '4.15', '0', 'buyBillController.php', '112', '', '0', '0'); -- id=112
UPDATE product SET  productBuyPrice = "6750" WHERE productId = 254 ;
UPDATE buybilldetail SET  quantitybefore = 1 WHERE buybilldetailid = 112 ;
UPDATE product SET productName = 'لفه سلك 10 ملي شعر الفؤاد 100 متر ', productDescription = '', productCatId = '10', productBuyPrice = '6750.00', productSellAllPrice = '7050.00', productSellUnitPrice = '7250.00', productSellHalfPrice = '7050.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00254',type ='0', expireDate = '0' , dailyentryId = '302',isService = '0',isOptic = '0',lastbuyprice = '6750',lastbuyprice_withDiscount = '6750',meanbuyprice = '6662.62',meanbuyprice_withDiscount = '6662.62' , productbuypricereal = '6300.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '10.32' , buyhalf_precentage = '10.32' , buypart_precentage = '13.49',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='6300',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='6750',meanbuyprice_withTax='6662.62',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='6750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '254';
UPDATE buybilldetail SET  lastbuyprice = 6750 , meanbuyprice = 6662.62, lastbuyprice_withDiscount = 6750, meanbuyprice_withDiscount = 6662.62
        , lastbuyprice_withTax = 6750, meanbuyprice_withTax = 6662.62, lastbuyprice_withDiscountAndTax = 6750
                where buybilldetailid = 112;
UPDATE productunit SET proUnitBuyPrice  = 6750 * productnumber WHERE productid = 254;
UPDATE storedetail SET  productquantity = '5.15', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '254';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('254', '1', '4.15', '0', '32', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1', '5.15', '1', '2026-09-28 11:33:33','0','0'); -- id=2102
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 ('00229', '32', '10', '229', '25', '1000', '25000.00', '0', '', '2026-09-28 11:39:50', '229','','','0','0','0','0','0',null,'1000','25000','0','0','0','0','0','0','0','0','1'); -- id=113
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-28 11:33:33', 1, 229, 0, 0
                    , 1000, 25, 0, 0, 1, '2026-09-28 11:39:53')
                ON DUPLICATE KEY UPDATE buyprice = 1000,
                        buyQuantity =buyQuantity+25, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-28 11:39:53' ; -- id=113
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('229', '1000', '25', '0', 'buyBillController.php', '113', '', '0', '0'); -- id=113
UPDATE product SET  productBuyPrice = "1000" WHERE productId = 229 ;
UPDATE buybilldetail SET  quantitybefore = 15 WHERE buybilldetailid = 113 ;
UPDATE product SET productName = 'لفه سلك 1.5 ملي سويدي', productDescription = '', productCatId = '10', productBuyPrice = '1000.00', productSellAllPrice = '1090.00', productSellUnitPrice = '1120.00', productSellHalfPrice = '1090.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00229',type ='0', expireDate = '0' , dailyentryId = '272',isService = '0',isOptic = '0',lastbuyprice = '1000',lastbuyprice_withDiscount = '1000',meanbuyprice = '1000',meanbuyprice_withDiscount = '1000' , productbuypricereal = '1000.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.00' , buyhalf_precentage = '9.00' , buypart_precentage = '12.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1000',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='1000',meanbuyprice_withTax='1000',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='1000',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '229';
UPDATE buybilldetail SET  lastbuyprice = 1000 , meanbuyprice = 1000, lastbuyprice_withDiscount = 1000, meanbuyprice_withDiscount = 1000
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where buybilldetailid = 113;
UPDATE productunit SET proUnitBuyPrice  = 1000 * productnumber WHERE productid = 229;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '229';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '1', '25', '0', '32', 'اضافة فاتورة مشتريات', 'buyBillController.php', '15', '40', '1', '2026-09-28 11:33:33','0','0'); -- id=2103
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 ('00230', '32', '10', '230', '6', '1350', '8100.00', '0', '', '2026-09-28 11:39:50', '230','','','0','0','0','0','0',null,'1350','8100','0','0','0','0','0','0','0','0','1'); -- id=114
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-28 11:33:33', 1, 230, 0, 0
                    , 1350, 6, 0, 0, 1, '2026-09-28 11:39:54')
                ON DUPLICATE KEY UPDATE buyprice = 1350,
                        buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-28 11:39:54' ; -- id=114
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('230', '1350', '6', '0', 'buyBillController.php', '114', '', '0', '0'); -- id=114
UPDATE product SET  productBuyPrice = "1350" WHERE productId = 230 ;
UPDATE buybilldetail SET  quantitybefore = 5 WHERE buybilldetailid = 114 ;
UPDATE product SET productName = 'لفه سلك 2 ملي سويدي', productDescription = '', productCatId = '10', productBuyPrice = '1350.00', productSellAllPrice = '1450.00', productSellUnitPrice = '1520.00', productSellHalfPrice = '1450.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00230',type ='0', expireDate = '0' , dailyentryId = '273',isService = '0',isOptic = '0',lastbuyprice = '1350',lastbuyprice_withDiscount = '1350',meanbuyprice = '1336.36',meanbuyprice_withDiscount = '1336.36' , productbuypricereal = '1320.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.82' , buyhalf_precentage = '6.82' , buypart_precentage = '15.15',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1320',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='1350',meanbuyprice_withTax='1336.36',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='1350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '230';
UPDATE buybilldetail SET  lastbuyprice = 1350 , meanbuyprice = 1336.36, lastbuyprice_withDiscount = 1350, meanbuyprice_withDiscount = 1336.36
        , lastbuyprice_withTax = 1350, meanbuyprice_withTax = 1336.36, lastbuyprice_withDiscountAndTax = 1350
                where buybilldetailid = 114;
UPDATE productunit SET proUnitBuyPrice  = 1350 * productnumber WHERE productid = 230;
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '230';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '1', '6', '0', '32', 'اضافة فاتورة مشتريات', 'buyBillController.php', '5', '11', '1', '2026-09-28 11:33:33','0','0'); -- id=2104
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 ('00231', '32', '10', '231', '6', '1917', '11502.00', '0', '', '2026-09-28 11:39:50', '231','','','0','0','0','0','0',null,'1917','11502','0','0','0','0','0','0','0','0','1'); -- id=115
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-28 11:33:33', 1, 231, 0, 0
                    , 1917, 6, 0, 0, 1, '2026-09-28 11:39:55')
                ON DUPLICATE KEY UPDATE buyprice = 1917,
                        buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-28 11:39:55' ; -- id=115
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('231', '1917', '6', '0', 'buyBillController.php', '115', '', '0', '0'); -- id=115
UPDATE product SET  productBuyPrice = "1917" WHERE productId = 231 ;
UPDATE buybilldetail SET  quantitybefore = 8 WHERE buybilldetailid = 115 ;
UPDATE product SET productName = 'لفه سلك 3 ملي سويدي', productDescription = '', productCatId = '10', productBuyPrice = '1917.00', productSellAllPrice = '2090.00', productSellUnitPrice = '2130.00', productSellHalfPrice = '2090.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00231',type ='0', expireDate = '0' , dailyentryId = '274',isService = '0',isOptic = '0',lastbuyprice = '1917',lastbuyprice_withDiscount = '1917',meanbuyprice = '1917',meanbuyprice_withDiscount = '1917' , productbuypricereal = '1917.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.02' , buyhalf_precentage = '9.02' , buypart_precentage = '11.11',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1917',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='1917',meanbuyprice_withTax='1917',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='1917',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '231';
UPDATE buybilldetail SET  lastbuyprice = 1917 , meanbuyprice = 1917, lastbuyprice_withDiscount = 1917, meanbuyprice_withDiscount = 1917
        , lastbuyprice_withTax = 1917, meanbuyprice_withTax = 1917, lastbuyprice_withDiscountAndTax = 1917
                where buybilldetailid = 115;
UPDATE productunit SET proUnitBuyPrice  = 1917 * productnumber WHERE productid = 231;
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '231';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('231', '1', '6', '0', '32', 'اضافة فاتورة مشتريات', 'buyBillController.php', '8', '14', '1', '2026-09-28 11:33:33','0','0'); -- id=2105
UPDATE supplier SET  suppliercurrentDebt = '123000',suppliercurrentDebtInCurrency= '123000' , userid = '1', supplierdate = '2026-09-28 11:39:50'   WHERE supplierid = '7';
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 ('7', '85000.00', '38000', '0', 'اضافة فاتورة مشتريات', '32', '123000', '2026-09-28 11:33:33', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','38000','1','85000','38000','123000','0',''); -- id=58
UPDATE save SET  savecurrentvalue = '-465696.03',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-360667.03','105029', '1', '1', 'اضافة فاتورة مشتريات', '32', '-465696.03', '2026-09-28 11:33:33', '1',  'buyBillController.php','0','','0'); -- id=162
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '143029', '143029', '2026-09-28', '1', '0', '0', '2026-09-28 11:39:56','اضافة فاتورة مشتريات رقم 32','1','0',null,'0','32','buyBillController.php?do=details&id=32'); -- id=1030
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1030', '382', '143029', '','0'); -- id=1030
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2506214.37', 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 ('1030', '425', '143029', '','0'); -- id=1030
UPDATE accountstree SET name = 'طارق شوقي', customName = 'طارق شوقي', customNameEn = 'طارق شوقي', nameEn = 'طارق شوقي', parent = '81', accountNature = '1', theValue = '228029', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-13 16:04:00' WHERE id = '425';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '105029', '105029', '2026-09-28', '1', '0', '0', '2026-09-28 11:39:56','اضافة فاتورة مشتريات رقم 32 - سداد الفاتورة للمورد','1','0',null,'0','32','buyBillController.php?do=details&id=32'); -- id=1031
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1031', '425', '105029', '','0'); -- id=1031
UPDATE accountstree SET name = 'طارق شوقي', customName = 'طارق شوقي', customNameEn = 'طارق شوقي', nameEn = 'طارق شوقي', parent = '81', accountNature = '1', theValue = '123000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-13 16:04:00' WHERE id = '425';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1031', '383', '105029', '','0'); -- id=1031
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-305614.49', 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='1030,1031' where buybillid=32;
COMMIT;
UPDATE product SET overAllAveragePrice = 1040 WHERE productId = 208;UPDATE product SET overAllAveragePrice = 1000 WHERE productId = 229;UPDATE product SET overAllAveragePrice = 1350 WHERE productId = 230;UPDATE product SET overAllAveragePrice = 1917 WHERE productId = 231;UPDATE product SET overAllAveragePrice = 650 WHERE productId = 249;UPDATE product SET overAllAveragePrice = 6750 WHERE productId = 254;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:09:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:39:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-28 11:39:58', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=32'); -- id=2669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:10:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:40:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 11:40:25', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2670
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:10:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:40:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-28 11:40:30', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=2671
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:11:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:41:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-28 11:41:11', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=2672
UPDATE storedetail SET  productquantity = '140', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '255';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('255', '1', '89', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '51', '140', '1', '2026-09-28','0','0'); -- id=2106
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5785', '5785', '2026-09-28', '1', '0', '0', '2026-09-28 11:41:11','اعادة جرد للمنتج : (متر سلك 10 ملي شعر الفؤاد/اسلاك) فى مخزن : (المخزن الرئيسي) بالكمية : 140','1','0',null,'0','2106','inventoryController.php?do=details&id=2106'); -- id=1032
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1032', '382', '5785', '','0'); -- id=1032
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2511999.37', 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 ('1032', '188', '5785', '','0'); -- id=1032
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-58957.75', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:11:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:41:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 11:41:16', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2673
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:12:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:42:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 11:42:39', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2674

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aba363d1f1a5
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 11:42:39', '06aba363d1f1a5', '1', '0.00', '0', '0', '1', '12652.50', '12652.5', '12652.5', '0', '1', '2026-09-28 11:42:39', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '2.15' ,'0','','','','','-1','0','0','0','0','0','12652','0','','0','0','12652.5','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=152
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','اضافة فاتورة مبيعات','152', '0', '2026-09-28 11:42:40', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '12652.5', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-28 11:42:39','0','0','',''); -- id=255
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1.15 where id = 112;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('6750','00254', '152', '10', '254', '1.15', '7250', '8337.5', '0', '', '1', '2026-09-28 11:42:40', '254', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','112-1.15,','1','1','0','0','7250','8337.5','0','','0','0.00','0','0','0','0'); -- id=1048
UPDATE sellbilldetail SET  lastbuyprice = 6750.00 , meanbuyprice = 6662.62, lastbuyprice_withDiscount = 6750.00, meanbuyprice_withDiscount = 6662.62
        , lastbuyprice_withTax = 6750, meanbuyprice_withTax = 6662.62, lastbuyprice_withDiscountAndTax = 6750
                where sellbilldetailid = 1048;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (254, '2026-09-28', 8337.5, 7762.5, 7762.5
                    , 7662.013, 7762.5, 7662.013, 7762.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1.15, 0, 7762.5, 7662.013, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8337.5, sellCostBuyPrice =sellCostBuyPrice+7762.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7762.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7662.013
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7762.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7662.013
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7762.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7762.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7662.013
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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.15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 8337.5, 7762.5, 7762.5
                    , 7662.013, 7762.5, 7662.013, 7762.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7762.5, 7662.013, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8337.5, sellCostBuyPrice =sellCostBuyPrice+7762.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7762.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7662.013
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7762.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7662.013
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7762.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7762.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7662.013
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-28 11:42:40' WHERE storedetailid = '254';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('254', '1', '1.15', '1', '152', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5.15', '4', '1', '2026-09-28 11:42:40','0','0'); -- id=2107
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4000','00253', '152', '10', '253', '1', '4315', '4315', '0', '', '1', '2026-09-28 11:42:40', '253', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','4315','4315','0','','0','0.00','0','0','0','0'); -- id=1049
UPDATE sellbilldetail SET  lastbuyprice = 4000.00 , meanbuyprice = 4000.00, lastbuyprice_withDiscount = 4000.00, meanbuyprice_withDiscount = 4000.00
        , lastbuyprice_withTax = 4000, meanbuyprice_withTax = 4000, lastbuyprice_withDiscountAndTax = 4000
                where sellbilldetailid = 1049;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (253, '2026-09-28', 4315, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4315, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 4315, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4315, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-28 11:42:40' WHERE storedetailid = '253';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('253', '1', '1', '1', '152', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '13', '1', '2026-09-28 11:42:40','0','0'); -- id=2108
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-453043.53125',  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 ('-465696.03125','12652.5', '0', '1', 'اضافة فاتورة مبيعات', '152', '-453043.53125', '2026-09-28 11:42:41', '1',  'sellbillController.php','1','','0'); -- id=163
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '12652.5', '12652.5', '2026-09-28', '1', '0', '0', '2026-09-28 11:42:41','اضافة فاتورة مبيعات رقم 152','1','0',null,'0','152','sellbillController.php?do=showDetail&sellbillid=152'); -- id=1033
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1033', '383', '12652.5', '','0'); -- id=1033
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-292961.99', 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 ('1033', '143', '12652.5', '','0'); -- id=1033
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '576634.87', 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 ( '11762.5', '11762.5', '2026-09-28', '1', '0', '0', '2026-09-28 11:42:41','اضافة فاتورة مبيعات رقم 152 - صرف البضاعة من المخزن','1','0',null,'0','152','sellbillController.php?do=showDetail&sellbillid=152'); -- id=1034
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1034', '402', '11762.5', '','0'); -- id=1034
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '533175.8', 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 ('1034', '382', '11762.5', '','0'); -- id=1034
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2500236.87', 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='1033,0,1034' where sellbillid=152;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 12652.5, 11762.5, 11762.5
                    , 11662.013, 11762.5, 11662.013, 11762.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11762.5, 11662.013, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12652.5, sellCostBuyPrice =sellCostBuyPrice+11762.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11762.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11662.013
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11762.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11662.013
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11762.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11762.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11662.013
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 12652.5, 11762.5, 11762.5
                    , 11662.013, 11762.5, 11662.013, 11762.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11762.5, 11662.013, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12652.5, sellCostBuyPrice =sellCostBuyPrice+11762.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11762.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11662.013
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11762.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11662.013
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11762.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11762.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11662.013
                        , returnSellVal = returnSellVal+0, 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, 12652.5, 11762.5, 11762.5
                    , 11662.013, 11762.5, 11662.013, 11762.5, 11762.5, 11662.013)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+12652.5, netSellCostBuyPrice = netSellCostBuyPrice+11762.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+11762.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+11662.013
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+11762.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+11662.013
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+11762.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+11762.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+11662.013;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aba363d1f1a5 and sellbillId = 152 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:12:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:42:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 11:42:42', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2675
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:13:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:43:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 11:43:22', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2676
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:13:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:43:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-28 11:43:27', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=2677
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:13:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:43:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-28 11:43:34', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=2678
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:13:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:43:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-28 11:43:37', '1', 'details', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=details&id=20'); -- id=2679
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 08:14:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 11:44:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 11:44:51', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2680
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:10:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:40:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:40:21', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2681
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:10:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:40:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:40:23', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2682
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:10:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:40:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:40:31', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2683
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:10:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:40:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:40:37', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=143'); -- id=2684
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:11:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:41:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 13:41:40', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2685
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:16:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:46:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 13:46:38', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=2686
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 ('كيس قفيز 15 ملي بلاستيك ','','6','19','22','23','22','2026-09-28','0','1','0','','0','0','0','0','0','19','19','19','19','19','0','15.79','15.79','21.05','.','0','0','0','19','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','19','19','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','19','0','0','0','0','0','0','','','0','0','0','0'); -- id=527
UPDATE product SET productName = 'كيس قفيز 15 ملي بلاستيك ', productDescription = '', productCatId = '6', productBuyPrice = '19', productSellAllPrice = '22', productSellUnitPrice = '23', productSellHalfPrice = '22', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00527',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '19',lastbuyprice_withDiscount = '19',meanbuyprice = '19',meanbuyprice_withDiscount = '19' , productbuypricereal = '19' , buypricereal_precentage = '0' , buytotal_precentage = '15.79' , buyhalf_precentage = '15.79' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='19',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='19',meanbuyprice_withTax='19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='19',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '527';
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', '527', '1.00', '2026-09-28', '1', '0','0052701','22','22','23','19','','0','0','0','0','0','0','0','0','0','0'); -- id=527
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('527', '1', '20', '1', '2026-09-28'); -- id=527
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '20', '0', '527', 'إضافة منتج', 'productController.php', '0', '20', '1', '2026-09-28','0','0'); -- id=2109
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (527, 1,'2026-09-28 13:46:39',1)
                ON DUPLICATE KEY UPDATE productid = 527, edited = 1, sysdate = '2026-09-28 13:46:39', userid = 1; -- id=655
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '380', '380', '2026-09-28', '1', '0', '0', '2026-09-28 13:46:39','إضافة منتج كيس قفيز 15 ملي بلاستيك  الكمية 20','1','0','0','0','527','productController.php?do=edit&id=527'); -- id=1035
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1035', '382', '380', '','0'); -- id=1035
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2500616.87', 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 ('1035', '121', '380', '','0'); -- id=1035
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1529117.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كيس قفيز 15 ملي بلاستيك ', productDescription = '', productCatId = '6', productBuyPrice = '19.00', productSellAllPrice = '22.00', productSellUnitPrice = '23.00', productSellHalfPrice = '22.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00527',type ='0', expireDate = '0' , dailyentryId = '1035',isService = '0',isOptic = '0',lastbuyprice = '19',lastbuyprice_withDiscount = '19',meanbuyprice = '19',meanbuyprice_withDiscount = '19' , productbuypricereal = '19' , buypricereal_precentage = '0' , buytotal_precentage = '15.79' , buyhalf_precentage = '15.79' , buypart_precentage = '21.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='19',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='19',meanbuyprice_withTax='19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='19',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '527';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('كيس قفيز 20 ملي بلاستيك ','','6','23','25','25','25','2026-09-28','0','1','0','','0','0','0','0','0','23','23','23','23','23','0','8.7','8.7','8.7','.','0','0','0','23','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','23','23','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','23','0','0','0','0','0','0','','','0','0','0','0'); -- id=528
UPDATE product SET productName = 'كيس قفيز 20 ملي بلاستيك ', productDescription = '', productCatId = '6', productBuyPrice = '23', productSellAllPrice = '25', productSellUnitPrice = '25', productSellHalfPrice = '25', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00528',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '23',lastbuyprice_withDiscount = '23',meanbuyprice = '23',meanbuyprice_withDiscount = '23' , productbuypricereal = '23' , buypricereal_precentage = '0' , buytotal_precentage = '8.7' , buyhalf_precentage = '8.7' , buypart_precentage = '8.7',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='23',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='23',meanbuyprice_withTax='23',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='23',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '528';
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', '528', '1.00', '2026-09-28', '1', '0','0052801','25','25','25','23','','0','0','0','0','0','0','0','0','0','0'); -- id=528
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('528', '1', '20', '1', '2026-09-28'); -- id=528
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('528', '1', '20', '0', '528', 'إضافة منتج', 'productController.php', '0', '20', '1', '2026-09-28','0','0'); -- id=2110
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (528, 1,'2026-09-28 13:46:42',1)
                ON DUPLICATE KEY UPDATE productid = 528, edited = 1, sysdate = '2026-09-28 13:46:42', userid = 1; -- id=656
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '460', '460', '2026-09-28', '1', '0', '0', '2026-09-28 13:46:42','إضافة منتج كيس قفيز 20 ملي بلاستيك  الكمية 20','1','0','0','0','528','productController.php?do=edit&id=528'); -- id=1036
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1036', '382', '460', '','0'); -- id=1036
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2501076.87', 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 ('1036', '121', '460', '','0'); -- id=1036
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1529577.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'كيس قفيز 20 ملي بلاستيك ', productDescription = '', productCatId = '6', productBuyPrice = '23.00', productSellAllPrice = '25.00', productSellUnitPrice = '25.00', productSellHalfPrice = '25.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00528',type ='0', expireDate = '0' , dailyentryId = '1036',isService = '0',isOptic = '0',lastbuyprice = '23',lastbuyprice_withDiscount = '23',meanbuyprice = '23',meanbuyprice_withDiscount = '23' , productbuypricereal = '23' , buypricereal_precentage = '0' , buytotal_precentage = '8.7' , buyhalf_precentage = '8.7' , buypart_precentage = '8.7',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='23',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='23',meanbuyprice_withTax='23',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='23',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '528';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('متر سلك ترمو 2 ملي المصريه','','6','23','26','26','26','2026-09-28','0','1','0','','0','0','0','0','0','23','23','23','23','23','0','13.04','13.04','13.04','.','0','0','0','23','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','23','23','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','23','0','0','0','0','0','0','','','0','0','0','0'); -- id=529
UPDATE product SET productName = 'متر سلك ترمو 2 ملي المصريه', productDescription = '', productCatId = '6', productBuyPrice = '23', productSellAllPrice = '26', productSellUnitPrice = '26', productSellHalfPrice = '26', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00529',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '23',lastbuyprice_withDiscount = '23',meanbuyprice = '23',meanbuyprice_withDiscount = '23' , productbuypricereal = '23' , buypricereal_precentage = '0' , buytotal_precentage = '13.04' , buyhalf_precentage = '13.04' , buypart_precentage = '13.04',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='23',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='23',meanbuyprice_withTax='23',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='23',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '529';
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', '529', '1.00', '2026-09-28', '1', '0','0052901','26','26','26','23','','0','0','0','0','0','0','0','0','0','0'); -- id=529
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('529', '1', '30', '1', '2026-09-28'); -- id=529
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '30', '0', '529', 'إضافة منتج', 'productController.php', '0', '30', '1', '2026-09-28','0','0'); -- id=2111
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (529, 1,'2026-09-28 13:46:43',1)
                ON DUPLICATE KEY UPDATE productid = 529, edited = 1, sysdate = '2026-09-28 13:46:43', userid = 1; -- id=657
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '690', '690', '2026-09-28', '1', '0', '0', '2026-09-28 13:46:43','إضافة منتج متر سلك ترمو 2 ملي المصريه الكمية 30','1','0','0','0','529','productController.php?do=edit&id=529'); -- id=1037
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1037', '382', '690', '','0'); -- id=1037
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2501766.87', 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 ('1037', '121', '690', '','0'); -- id=1037
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1530267.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'متر سلك ترمو 2 ملي المصريه', productDescription = '', productCatId = '6', productBuyPrice = '23.00', productSellAllPrice = '26.00', productSellUnitPrice = '26.00', productSellHalfPrice = '26.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00529',type ='0', expireDate = '0' , dailyentryId = '1037',isService = '0',isOptic = '0',lastbuyprice = '23',lastbuyprice_withDiscount = '23',meanbuyprice = '23',meanbuyprice_withDiscount = '23' , productbuypricereal = '23' , buypricereal_precentage = '0' , buytotal_precentage = '13.04' , buyhalf_precentage = '13.04' , buypart_precentage = '13.04',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='23',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='23',meanbuyprice_withTax='23',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='23',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '529';
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','8','10','10','10','2026-09-28','0','1','0','','0','0','0','0','0','8','8','8','8','8','0','25','25','25','.','0','0','0','8','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','8','8','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','8','0','0','0','0','0','0','','','0','0','0','0'); -- id=530
UPDATE product SET productName = 'طاسه لمبه عامود ', productDescription = '', productCatId = '6', productBuyPrice = '8', productSellAllPrice = '10', productSellUnitPrice = '10', productSellHalfPrice = '10', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00530',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',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='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '530';
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', '530', '1.00', '2026-09-28', '1', '0','0053001','10','10','10','8','','0','0','0','0','0','0','0','0','0','0'); -- id=530
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('530', '1', '20', '1', '2026-09-28'); -- id=530
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '20', '0', '530', 'إضافة منتج', 'productController.php', '0', '20', '1', '2026-09-28','0','0'); -- id=2112
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (530, 1,'2026-09-28 13:46:45',1)
                ON DUPLICATE KEY UPDATE productid = 530, edited = 1, sysdate = '2026-09-28 13:46:45', userid = 1; -- id=658
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '160', '160', '2026-09-28', '1', '0', '0', '2026-09-28 13:46:45','إضافة منتج طاسه لمبه عامود  الكمية 20','1','0','0','0','530','productController.php?do=edit&id=530'); -- id=1038
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1038', '382', '160', '','0'); -- id=1038
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2501926.87', 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 ('1038', '121', '160', '','0'); -- id=1038
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1530427.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'طاسه لمبه عامود ', productDescription = '', productCatId = '6', productBuyPrice = '8.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00530',type ='0', expireDate = '0' , dailyentryId = '1038',isService = '0',isOptic = '0',lastbuyprice = '8',lastbuyprice_withDiscount = '8',meanbuyprice = '8',meanbuyprice_withDiscount = '8' , productbuypricereal = '8' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8',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='8',meanbuyprice_withTax='8',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '530';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:16:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:46:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 13:46:48', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2687
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:19:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:49:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:49:45', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2688
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 143;
UPDATE sellbill SET  sellbillsysdate = '2026-09-28 13:49:46', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '143';
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 984;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 8470, 7280, 7280
                    , 7217, 7280, 7217, 7280
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 7280, 7217, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8470, sellCostBuyPrice =sellCostBuyPrice-7280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7280, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7217
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7217
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7217
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-28', 8470, 7280, 7280
                    , 7217, 7280, 7217, 7280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7280, 7217, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8470, sellCostBuyPrice =sellCostBuyPrice-7280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7280, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7217
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7217
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7217
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '82.55', userid = '1', storedetaildate = '2026-09-28 13:49:46' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '7', '0', '143', 'تعديل فاتورة مبيعات', 'sellbillController.php', '75.55', '82.55', '1', '2026-09-26 16:55:00','0','0'); -- id=2113
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 = 985;
 INSERT INTO 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-09-28', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-97.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-97.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 = '707', userid = '1', storedetaildate = '2026-09-28 13:49:46' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '15', '0', '143', 'تعديل فاتورة مبيعات', 'sellbillController.php', '692', '707', '1', '2026-09-26 16:55:00','0','0'); -- id=2114
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 = 986;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '872', userid = '1', storedetaildate = '2026-09-28 13:49:46' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '143', 'تعديل فاتورة مبيعات', 'sellbillController.php', '857', '872', '1', '2026-09-26 16:55:00','0','0'); -- id=2115
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 987;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-09-28 13:49:46' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '0', '143', 'تعديل فاتورة مبيعات', 'sellbillController.php', '123', '124', '1', '2026-09-26 16:55:00','0','0'); -- id=2116
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 988;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2026-09-28 13:49:46' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '0', '143', 'تعديل فاتورة مبيعات', 'sellbillController.php', '221', '223', '1', '2026-09-26 16:55:00','0','0'); -- id=2117
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-6268.9', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','3506.10','9775.00','1','تعديل فاتورة مبيعات','143', '-6268.9', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '9775', '0', null, '0', null, null,'', '0','1','1','9775','1','2026-09-26 16:55:00','0','0','',''); -- id=256
UPDATE client SET  inUse = 0 where clientid = 5;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 9775, 8454.62, 8454.62
                    , 8391.62, 8454.62, 8391.62, 8454.62
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8454.62, 8391.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9775, sellCostBuyPrice =sellCostBuyPrice-8454.62
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8454.62, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8391.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8454.62, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8391.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8454.62
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8454.62
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8391.62
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 9775, 8454.62, 8454.62
                    , 8391.62, 8454.62, 8391.62, 8454.62
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8454.62, 8391.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9775, sellCostBuyPrice =sellCostBuyPrice-8454.62
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8454.62, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8391.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8454.62, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8391.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8454.62
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8454.62
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8391.62
                        , returnSellVal = returnSellVal-0, 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, 9775, 8454.62, 8454.62
                    , 8391.62, 8454.62, 8391.62, 8454.62, 8454.62, 8391.62)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-9775, netSellCostBuyPrice = netSellCostBuyPrice-8454.62
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-8454.62
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-8391.62
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-8454.62
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-8391.62
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-8454.62
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-8454.62
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-8391.62;

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


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

COMMIT;
BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:55:00', '06ab7da708e886', '5', '-6268.90', '4835.1', '0', '1', '11104', '11104', '0', '11104', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '47', '143', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=153
UPDATE client SET  clientdebt = '4835.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','-6268.90','11104','0','اضافة فاتورة مبيعات (معدله)','153', '4835.1', '2026-09-28 13:49:47', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '11104', '0', null, '0', null, null,'', '0','1','1','9775','1','2026-09-26 16:55:00','0','0','',''); -- id=257
UPDATE client SET  inUse = 0 where clientid = 5;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 110;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1040','00208', '153', '10', '208', '8', '1210', '9680', '0', '', '1', '2026-09-28 13:49:47', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','110-8,','1','1','0','0','1210','9680','0','','0','0.00','0','0','0','0'); -- id=1050
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1050;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74.55', userid = '1', storedetaildate = '2026-09-28 13:49:48' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '82.55', '74.55', '1', '2026-09-28 13:49:48','0','0'); -- id=2118
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '153', '6', '315', '16', '8', '128', '0', '', '1', '2026-09-28 13:49:48', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','128','0','','0','0.00','0','0','0','0'); -- id=1051
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 = 1051;
 INSERT INTO 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-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '691', userid = '1', storedetaildate = '2026-09-28 13:49:48' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '707', '691', '1', '2026-09-28 13:49:48','0','0'); -- id=2119
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '153', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-09-28 13:49:48', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','720','0','','0','0.00','0','0','0','0'); -- id=1052
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 = 1052;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '857', userid = '1', storedetaildate = '2026-09-28 13:49:48' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '872', '857', '1', '2026-09-28 13:49:48','0','0'); -- id=2120
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157.92','00186', '153', '20', '186', '1.00', '165', '165', '0', '', '1', '2026-09-28 13:49:48', '186', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','165','165','0','','0','0.00','0','0','0','0'); -- id=1053
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1053;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '1', storedetaildate = '2026-09-28 13:49:49' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '123', '1', '2026-09-28 13:49:49','0','0'); -- id=2121
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('139.2','00185', '153', '20', '185', '2.00', '150', '300', '0', '', '1', '2026-09-28 13:49:49', '185', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=1054
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1054;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '221', userid = '1', storedetaildate = '2026-09-28 13:49:49' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '223', '221', '1', '2026-09-28 13:49:49','0','0'); -- id=2122
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8','00530', '153', '6', '530', '1', '10', '10', '0', '', '1', '2026-09-28 13:49:49', '530', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','10','0','','0','0.00','0','0','0','0'); -- id=1055
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1055;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 13:49:49' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 13:49:49','0','0'); -- id=2123
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('23','00529', '153', '6', '529', '3', '26', '78', '0', '', '1', '2026-09-28 13:49:50', '529', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','78','0','','0','0.00','0','0','0','0'); -- id=1056
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1056;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-09-28 13:49:50' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '27', '1', '2026-09-28 13:49:50','0','0'); -- id=2124
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '153', '6', '527', '1', '23', '23', '0', '', '1', '2026-09-28 13:49:50', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=1057
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1057;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 13:49:50' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '153', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 13:49:50','0','0'); -- id=2125
UPDATE dailyentry SET totalcreditor = '9775.00', totaldebtor = '9775.00', thedate = '2026-09-27', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-27 14:48:44', entryComment = 'اضافة فاتورة مبيعات رقم 143', fromFlag = '1',related='0',isopeningentry='0',operationId='143',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=143' WHERE id = '1003';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9775.00', '9775.00', '2026-09-28', '1', '0', '1003', '2026-09-28 13:49:50','تم عكس القيد رقم 1003 ','1','0','0','0','0',''); -- id=1039
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1039', '430', '9775.00', '','0'); -- id=1039
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '-6268.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1039', '143', '9775.00', '','0'); -- id=1039
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '566859.87', 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 = '8314.62', totaldebtor = '8314.62', thedate = '2026-09-27', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-27 14:48:44', entryComment = 'اضافة فاتورة مبيعات رقم 143 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='143',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=143' WHERE id = '1004';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8314.62', '8314.62', '2026-09-28', '1', '0', '1004', '2026-09-28 13:49:51','تم عكس القيد رقم 1004 ','1','0','0','0','0',''); -- id=1040
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1040', '402', '8314.62', '','0'); -- id=1040
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '524861.18', 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 ('1040', '382', '8314.62', '','0'); -- id=1040
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2510241.49', 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 ( '11104', '11104', '2026-09-28', '1', '0', '0', '2026-09-28 13:49:51','اضافة فاتورة مبيعات رقم 153','1','0',null,'0','153','sellbillController.php?do=showDetail&sellbillid=153'); -- id=1041
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1041', '430', '11104', '','0'); -- id=1041
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '4835.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1041', '143', '11104', '','0'); -- id=1041
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '577963.87', 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 ( '9597.12', '9597.12', '2026-09-28', '1', '0', '0', '2026-09-28 13:49:51','اضافة فاتورة مبيعات رقم 153 - صرف البضاعة من المخزن','1','0',null,'0','153','sellbillController.php?do=showDetail&sellbillid=153'); -- id=1042
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1042', '402', '9597.12', '','0'); -- id=1042
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '534458.3', 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 ('1042', '382', '9597.12', '','0'); -- id=1042
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2500644.37', 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='1041,0,1042' where sellbillid=153;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11104, sellCostBuyPrice =sellCostBuyPrice+9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9525.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11104, sellCostBuyPrice =sellCostBuyPrice+9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9525.12
                        , returnSellVal = returnSellVal+0, 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, 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12, 9597.12, 9525.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11104, netSellCostBuyPrice = netSellCostBuyPrice+9597.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9597.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9525.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9597.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9525.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9597.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9597.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9525.12;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 143 and newid=153 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:19:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:49:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:49:53', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=153'); -- id=2689
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:20:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:50:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 13:50:45', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2690
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:20:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:50:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 13:50:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2691
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:21:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:51:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:51:00', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=153'); -- id=2692
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:21:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:51:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-09-28 13:51:30', '1', 'clientShowbure', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=2693
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:21:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:51:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-09-28 13:51:36', '1', 'clientShowbure', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=2694
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:22:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:52:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 13:52:13', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2695
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:22:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:52:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 13:52:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2696
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:23:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:53:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:53:46', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2697
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 ('صابر علي ' , '', '', '', '340', '', '0', '2026-09-28 13:54:45', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-28','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=40
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('40', '0', '0', '', ''); -- id=40
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 ('40','0','340','0','إضافة عميل جديد','40', '340', '2026-09-28 13:54:45', '1', 'clientController.php', '', '340', '0', null, '0', null, null,'', '0','1','1','340','1','','0','0','',''); -- id=258
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('صابر علي ', 'صابر علي ', 'صابر علي ', 'صابر علي ', '58', '0', '0', '0', '', '1', '1', '', '0', '3', '1', '', '1', '0', '2026-09-28 13:54:46'); -- id=472
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '340', '340', '2026-09-28', '1', '0', '0', '2026-09-28 13:54:46','تم اضافة عميل صابر علي ','1','0','0','0','40','clientController.php?do=edit&id=40'); -- id=1043
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1043', '472', '340', '','0'); -- id=1043
UPDATE accountstree SET name = 'صابر علي ', customName = 'صابر علي ', customNameEn = 'صابر علي ', nameEn = 'صابر علي ', parent = '58', accountNature = '0', theValue = '340', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 13:54:46' WHERE id = '472';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1043', '121', '340', '','0'); -- id=1043
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1530767.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
COMMIT;
UPDATE client SET clientname = 'صابر علي ', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '340.00', clientdetails = '', conditions = '0', clientdate = '2026-09-28', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '1043' , 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='472',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 = '40';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:25:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:55:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:55:07', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2698

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aba554b0e48e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(40,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 13:55:08', '06aba554b0e48e', '40', '340.00', '386.95', '0', '1', '46.95', '46.95', '0', '46.95', '1', '2026-09-28 13:55:08', '', '1', '0', 'صابر علي ', '1', '1', '3', '0', 'صابر علي ', '2' ,'0','','','','','-1','0','0','0','0','0','46','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=154
UPDATE client SET  clientdebt = '386.95', userid = '1' WHERE clientid = '40';
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 ('40','340.00','46.95','0','اضافة فاتورة مبيعات','154', '386.95', '2026-09-28 13:55:08', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '46.95', '0', null, '0', null, null,'', '0','1','1','46.95','1','2026-09-28 13:55:08','0','0','',''); -- id=259
UPDATE client SET  inUse = 0 where clientid = 40;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00004', '154', '1', '4', '1', '36', '36', '0', '', '1', '2026-09-28 13:55:09', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','36','0','','0','0.00','0','0','0','0'); -- id=1058
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1058;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-09-28', 36, 34.8, 34.8
                    , 34.8, 34.8, 34.8, 34.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 34.8, 34.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+34.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 36, 34.8, 34.8
                    , 34.8, 34.8, 34.8, 34.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 34.8, 34.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+34.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1618', userid = '1', storedetaildate = '2026-09-28 13:55:09' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '154', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1619', '1618', '1', '2026-09-28 13:55:09','0','0'); -- id=2126
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.55','00005', '154', '1', '5', '1', '10.95', '10.95', '0', '', '1', '2026-09-28 13:55:09', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','10.95','0','','0','0.00','0','0','0','0'); -- id=1059
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 1059;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 10.95, 10.55, 10.55
                    , 10.55, 10.55, 10.55, 10.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10.55, 10.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10.95, sellCostBuyPrice =sellCostBuyPrice+10.55
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10.55, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10.95, 10.55, 10.55
                    , 10.55, 10.55, 10.55, 10.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10.55, 10.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10.95, sellCostBuyPrice =sellCostBuyPrice+10.55
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10.55, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10.55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10.55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1129', userid = '1', storedetaildate = '2026-09-28 13:55:09' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '1', '1', '154', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1130', '1129', '1', '2026-09-28 13:55:09','0','0'); -- id=2127
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '46.95', '46.95', '2026-09-28', '1', '0', '0', '2026-09-28 13:55:09','اضافة فاتورة مبيعات رقم 154','1','0',null,'0','154','sellbillController.php?do=showDetail&sellbillid=154'); -- id=1044
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1044', '472', '46.95', '','0'); -- id=1044
UPDATE accountstree SET name = 'صابر علي ', customName = 'صابر علي ', customNameEn = 'صابر علي ', nameEn = 'صابر علي ', parent = '58', accountNature = '0', theValue = '386.95', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 13:54:46' WHERE id = '472';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1044', '143', '46.95', '','0'); -- id=1044
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '578010.82', 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 ( '45.35', '45.35', '2026-09-28', '1', '0', '0', '2026-09-28 13:55:09','اضافة فاتورة مبيعات رقم 154 - صرف البضاعة من المخزن','1','0',null,'0','154','sellbillController.php?do=showDetail&sellbillid=154'); -- id=1045
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1045', '402', '45.35', '','0'); -- id=1045
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '534503.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 ('1045', '382', '45.35', '','0'); -- id=1045
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2500599.02', 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='1044,0,1045' where sellbillid=154;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 46.95, 45.35, 45.35
                    , 45.35, 45.35, 45.35, 45.35
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,45.35, 45.35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+46.95, sellCostBuyPrice =sellCostBuyPrice+45.35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45.35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45.35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45.35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45.35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45.35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45.35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (40, '2026-09-28', 46.95, 45.35, 45.35
                    , 45.35, 45.35, 45.35, 45.35
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,45.35, 45.35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+46.95, sellCostBuyPrice =sellCostBuyPrice+45.35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45.35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45.35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45.35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45.35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45.35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45.35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 46.95, 45.35, 45.35
                    , 45.35, 45.35, 45.35, 45.35, 45.35, 45.35)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+46.95, netSellCostBuyPrice = netSellCostBuyPrice+45.35
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+45.35
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+45.35
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+45.35
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+45.35
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+45.35
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+45.35
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+45.35;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aba554b0e48e and sellbillId = 154 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:25:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:55:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:55:11', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2699
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:26:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:56:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:56:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2700
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:26:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:56:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:56:41', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2701
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:26:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:56:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:56:53', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=12'); -- id=2702
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:27:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:57:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:57:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2703
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:27:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:57:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:57:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2704
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:27:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:57:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:57:31', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=153'); -- id=2705
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:29:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:59:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:59:01', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=143'); -- id=2706
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:29:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 13:59:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 13:59:27', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=35'); -- id=2707
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:30:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:00:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:00:04', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=153'); -- id=2708
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:30:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:00:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:00:34', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2709
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 153;
UPDATE sellbill SET  sellbillsysdate = '2026-09-28 14:00:35', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '153';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 110;
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1050;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '82.55', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '74.55', '82.55', '1', '2026-09-26 16:55:00','0','0'); -- id=2128
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 = 1051;
 INSERT INTO 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-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0,16,0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-16
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '707', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '691', '707', '1', '2026-09-26 16:55:00','0','0'); -- id=2129
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 = 1052;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '872', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '857', '872', '1', '2026-09-26 16:55:00','0','0'); -- id=2130
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1053;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '123', '124', '1', '2026-09-26 16:55:00','0','0'); -- id=2131
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1054;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '221', '223', '1', '2026-09-26 16:55:00','0','0'); -- id=2132
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1055;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=2133
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1056;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '27', '30', '1', '2026-09-26 16:55:00','0','0'); -- id=2134
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1057;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-28 14:00:35' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '153', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=2135
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-6268.9', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','4835.10','11104.00','1','تعديل فاتورة مبيعات','153', '-6268.9', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '11104', '0', null, '0', null, null,'', '0','1','1','11104','1','2026-09-26 16:55:00','0','0','',''); -- id=260
UPDATE client SET  inUse = 0 where clientid = 5;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11104, sellCostBuyPrice =sellCostBuyPrice-9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9525.12
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11104, sellCostBuyPrice =sellCostBuyPrice-9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9525.12
                        , returnSellVal = returnSellVal-0, 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, 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12, 9597.12, 9525.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-11104, netSellCostBuyPrice = netSellCostBuyPrice-9597.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-9597.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-9525.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-9597.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-9525.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-9597.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-9597.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-9525.12;

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


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

COMMIT;
BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:55:00', '06ab7da708e886', '5', '-6268.90', '4835.1', '0', '1', '11104', '11104', '0', '11104', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '47', '153', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=155
UPDATE client SET  clientdebt = '4835.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','-6268.90','11104','0','اضافة فاتورة مبيعات (معدله)','155', '4835.1', '2026-09-28 14:00:36', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '11104', '0', null, '0', null, null,'', '0','1','1','11104','1','2026-09-26 16:55:00','0','0','',''); -- id=261
UPDATE client SET  inUse = 0 where clientid = 5;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 110;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1040','00208', '155', '10', '208', '8.00', '1210', '9680', '0', '', '1', '2026-09-28 14:00:36', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','110-8,','1','1','0','0','1210','9680','0','','0','0.00','0','0','0','0'); -- id=1060
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1060;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74.55', userid = '1', storedetaildate = '2026-09-28 14:00:37' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '82.55', '74.55', '1', '2026-09-28 14:00:37','0','0'); -- id=2136
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '155', '6', '315', '16.00', '8', '128', '0', '', '1', '2026-09-28 14:00:37', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','128','0','','0','0.00','0','0','0','0'); -- id=1061
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 = 1061;
 INSERT INTO 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-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '691', userid = '1', storedetaildate = '2026-09-28 14:00:37' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '707', '691', '1', '2026-09-28 14:00:37','0','0'); -- id=2137
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '155', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-09-28 14:00:37', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','720','0','','0','0.00','0','0','0','0'); -- id=1062
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 = 1062;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '857', userid = '1', storedetaildate = '2026-09-28 14:00:37' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '872', '857', '1', '2026-09-28 14:00:37','0','0'); -- id=2138
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157.92','00186', '155', '20', '186', '1.00', '165', '165', '0', '', '1', '2026-09-28 14:00:37', '186', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','165','165','0','','0','0.00','0','0','0','0'); -- id=1063
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1063;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '1', storedetaildate = '2026-09-28 14:00:38' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '123', '1', '2026-09-28 14:00:38','0','0'); -- id=2139
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('139.2','00185', '155', '20', '185', '2.00', '150', '300', '0', '', '1', '2026-09-28 14:00:38', '185', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=1064
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1064;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '221', userid = '1', storedetaildate = '2026-09-28 14:00:38' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '223', '221', '1', '2026-09-28 14:00:38','0','0'); -- id=2140
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8','00530', '155', '6', '530', '1.00', '10', '10', '0', '', '1', '2026-09-28 14:00:38', '530', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','10','0','','0','0.00','0','0','0','0'); -- id=1065
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1065;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 14:00:38' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 14:00:38','0','0'); -- id=2141
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('23','00529', '155', '6', '529', '3.00', '26', '78', '0', '', '1', '2026-09-28 14:00:38', '529', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','78','0','','0','0.00','0','0','0','0'); -- id=1066
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1066;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-09-28 14:00:39' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '27', '1', '2026-09-28 14:00:39','0','0'); -- id=2142
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '155', '6', '527', '1.00', '23', '23', '0', '', '1', '2026-09-28 14:00:39', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=1067
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1067;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 14:00:39' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '155', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 14:00:39','0','0'); -- id=2143
UPDATE dailyentry SET totalcreditor = '11104.00', totaldebtor = '11104.00', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 13:49:51', entryComment = 'اضافة فاتورة مبيعات رقم 153', fromFlag = '1',related='0',isopeningentry='0',operationId='153',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=153' WHERE id = '1041';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11104.00', '11104.00', '2026-09-28', '1', '0', '1041', '2026-09-28 14:00:39','تم عكس القيد رقم 1041 ','1','0','0','0','0',''); -- id=1046
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1046', '430', '11104.00', '','0'); -- id=1046
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '-6268.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1046', '143', '11104.00', '','0'); -- id=1046
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '566906.82', 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 = '9597.12', totaldebtor = '9597.12', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 13:49:51', entryComment = 'اضافة فاتورة مبيعات رقم 153 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='153',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=153' WHERE id = '1042';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9597.12', '9597.12', '2026-09-28', '1', '0', '1042', '2026-09-28 14:00:40','تم عكس القيد رقم 1042 ','1','0','0','0','0',''); -- id=1047
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1047', '402', '9597.12', '','0'); -- id=1047
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '524906.53', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1047', '382', '9597.12', '','0'); -- id=1047
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2510196.14', 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 ( '11104', '11104', '2026-09-28', '1', '0', '0', '2026-09-28 14:00:40','اضافة فاتورة مبيعات رقم 155','1','0',null,'0','155','sellbillController.php?do=showDetail&sellbillid=155'); -- id=1048
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1048', '430', '11104', '','0'); -- id=1048
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '4835.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1048', '143', '11104', '','0'); -- id=1048
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '578010.82', 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 ( '9597.12', '9597.12', '2026-09-28', '1', '0', '0', '2026-09-28 14:00:40','اضافة فاتورة مبيعات رقم 155 - صرف البضاعة من المخزن','1','0',null,'0','155','sellbillController.php?do=showDetail&sellbillid=155'); -- id=1049
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1049', '402', '9597.12', '','0'); -- id=1049
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '534503.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 ('1049', '382', '9597.12', '','0'); -- id=1049
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2500599.02', 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='1048,0,1049' where sellbillid=155;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11104, sellCostBuyPrice =sellCostBuyPrice+9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9525.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11104, sellCostBuyPrice =sellCostBuyPrice+9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9525.12
                        , returnSellVal = returnSellVal+0, 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, 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12, 9597.12, 9525.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11104, netSellCostBuyPrice = netSellCostBuyPrice+9597.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9597.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9525.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9597.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9525.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9597.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9597.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9525.12;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 153 and newid=155 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:30:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:00:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:00:41', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=155'); -- id=2710
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:34:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:04:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-09-28 14:04:36', '1', 'clientShowbure', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=2711
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:34:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:04:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsnewController.php', '2026-09-28 14:04:43', '1', 'clientShowbure', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsnewController.php?do=clientShowbure'); -- id=2712
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:38:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:08:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:08:43', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=36'); -- id=2713
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:39:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:09:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:09:48', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=155'); -- id=2714
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:40:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:10:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:10:31', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2715
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:40:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:10:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:10:39', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2716
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:40:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:10:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:10:45', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=136'); -- id=2717
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:41:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:11:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:11:26', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2718
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 136;
UPDATE sellbill SET  sellbillsysdate = '2026-09-28 14:11:27', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '136';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 48;
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 943;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, sellCostBuyPrice =sellCostBuyPrice-79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, sellCostBuyPrice =sellCostBuyPrice-79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '280', userid = '1', storedetaildate = '2026-09-28 14:11:27' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '0', '136', 'تعديل فاتورة مبيعات', 'sellbillController.php', '278', '280', '1', '2026-09-26 12:06:36','0','0'); -- id=2144
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 944;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-65, sellCostBuyPrice =sellCostBuyPrice-59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-59, sellCostMeanBuyPrice = sellCostMeanBuyPrice-59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-59
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-65, sellCostBuyPrice =sellCostBuyPrice-59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-59, sellCostMeanBuyPrice = sellCostMeanBuyPrice-59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-59
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '445', userid = '1', storedetaildate = '2026-09-28 14:11:27' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '10', '0', '136', 'تعديل فاتورة مبيعات', 'sellbillController.php', '435', '445', '1', '2026-09-26 12:06:36','0','0'); -- id=2145
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 945;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-48, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-48, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '125', userid = '1', storedetaildate = '2026-09-28 14:11:27' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '4', '0', '136', 'تعديل فاتورة مبيعات', 'sellbillController.php', '121', '125', '1', '2026-09-26 12:06:36','0','0'); -- id=2146
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 46;
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 418.03, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 418.03
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 418.03, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 946;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-475, sellCostBuyPrice =sellCostBuyPrice-435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-435, sellCostMeanBuyPrice = sellCostMeanBuyPrice-418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-418.03
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-475, sellCostBuyPrice =sellCostBuyPrice-435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-435, sellCostMeanBuyPrice = sellCostMeanBuyPrice-418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-418.03
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-09-28 14:11:27' WHERE storedetailid = '73';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '1', '1', '0', '136', 'تعديل فاتورة مبيعات', 'sellbillController.php', '28', '29', '1', '2026-09-26 12:06:36','0','0'); -- id=2147
CALL clientInUse(18,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '520', userid = '1' WHERE clientid = '18';
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 ('18','1198.00','678.00','1','تعديل فاتورة مبيعات','136', '520', '2026-09-26 12:06:36', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '678', '0', null, '0', null, null,'', '0','1','1','678','1','2026-09-26 12:06:36','0','0','',''); -- id=262
UPDATE client SET  inUse = 0 where clientid = 18;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 678, 617.6, 617.6
                    , 603.23, 617.6, 603.23, 606.06
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,617.6, 603.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-678, sellCostBuyPrice =sellCostBuyPrice-617.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-617.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-603.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-617.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-603.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-606.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-617.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-603.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-28', 678, 617.6, 617.6
                    , 603.23, 617.6, 603.23, 606.06
                    , 0, 0, 0, 0
                    , 0, 0, 0, 617.6, 603.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-678, sellCostBuyPrice =sellCostBuyPrice-617.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-617.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-603.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-617.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-603.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-606.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-617.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-603.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 678, 617.6, 617.6
                    , 603.23, 617.6, 603.23, 606.06, 617.6, 603.23)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-678, netSellCostBuyPrice = netSellCostBuyPrice-617.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-617.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-603.23
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-617.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-603.23
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-606.06
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-617.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-603.23;

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


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

COMMIT;
BEGIN;
CALL clientInUse(18,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 12:06:36', '06ab798ee5ed8b', '18', '520.00', '1958', '0', '1', '1438', '1438', '0', '1438', '1', '2026-09-26 12:06:36', '', '1', '0', 'محمد السعيد صالح ', '1', '1', '3', '0', 'محمد السعيد صالح ', '19', '136', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=156
UPDATE client SET  clientdebt = '1958', userid = '1' WHERE clientid = '18';
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 ('18','520.00','1438','0','اضافة فاتورة مبيعات (معدله)','156', '1958', '2026-09-28 14:11:28', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '1438', '0', null, '0', null, null,'', '0','1','1','678','1','2026-09-26 12:06:36','0','0','',''); -- id=263
UPDATE client SET  inUse = 0 where clientid = 18;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '156', '12', '83', '2.00', '45', '90', '0', '', '1', '2026-09-28 14:11:28', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-2,','1','1','0','0','45','90','0','','0','0.00','0','0','0','0'); -- id=1068
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 = 1068;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '278', userid = '1', storedetaildate = '2026-09-28 14:11:28' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '1', '156', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '280', '278', '1', '2026-09-28 14:11:28','0','0'); -- id=2148
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '156', '12', '86', '10.00', '6.5', '65', '0', '', '1', '2026-09-28 14:11:29', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.5','65','0','','0','0.00','0','0','0','0'); -- id=1069
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 1069;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '435', userid = '1', storedetaildate = '2026-09-28 14:11:29' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '10', '1', '156', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '445', '435', '1', '2026-09-28 14:11:29','0','0'); -- id=2149
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.1','00088', '156', '12', '88', '4.00', '12', '48', '0', '', '1', '2026-09-28 14:11:29', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','48','0','','0','0.00','0','0','0','0'); -- id=1070
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1070;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '121', userid = '1', storedetaildate = '2026-09-28 14:11:29' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '4', '1', '156', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '125', '121', '1', '2026-09-28 14:11:29','0','0'); -- id=2150
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 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 ('415','00073', '156', '12', '73', '1.00', '475', '475', '0', '', '1', '2026-09-28 14:11:29', '73', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','46-1,','1','1','0','0','475','475','0','','0','0.00','0','0','0','0'); -- id=1071
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 418.03, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 418.03
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 418.03, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 1071;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+435, sellCostMeanBuyPrice = sellCostMeanBuyPrice+418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+418.03
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+435, sellCostMeanBuyPrice = sellCostMeanBuyPrice+418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+418.03
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-09-28 14:11:30' WHERE storedetailid = '73';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '1', '1', '1', '156', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '29', '28', '1', '2026-09-28 14:11:30','0','0'); -- id=2151
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 45;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('332','00070', '156', '12', '70', '2', '380', '760', '0', '', '1', '2026-09-28 14:11:30', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','45-2,','1','1','0','0','380','760','0','','0','0.00','0','0','0','0'); -- id=1072
UPDATE sellbilldetail SET  lastbuyprice = 348.00 , meanbuyprice = 332.81, lastbuyprice_withDiscount = 348.00, meanbuyprice_withDiscount = 332.81
        , lastbuyprice_withTax = 348, meanbuyprice_withTax = 332.81, lastbuyprice_withDiscountAndTax = 348
                where sellbilldetailid = 1072;
 INSERT INTO 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-09-28', 760, 696, 696
                    , 665.62, 696, 665.62, 680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 696, 665.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+665.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+665.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+665.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 760, 696, 696
                    , 665.62, 696, 665.62, 680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 696, 665.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+665.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+665.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+665.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '93', userid = '1', storedetaildate = '2026-09-28 14:11:30' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '2', '1', '156', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '95', '93', '1', '2026-09-28 14:11:30','0','0'); -- id=2152
UPDATE dailyentry SET totalcreditor = '678.00', totaldebtor = '678.00', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 18:45:15', entryComment = 'اضافة فاتورة مبيعات رقم 136', fromFlag = '1',related='0',isopeningentry='0',operationId='136',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=136' WHERE id = '978';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '678.00', '678.00', '2026-09-28', '1', '0', '978', '2026-09-28 14:11:30','تم عكس القيد رقم 978 ','1','0','0','0','0',''); -- id=1050
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1050', '447', '678.00', '','0'); -- id=1050
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '520', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:42:27' WHERE id = '447';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1050', '143', '678.00', '','0'); -- id=1050
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '577332.82', 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 = '597.60', totaldebtor = '597.60', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 18:45:15', entryComment = 'اضافة فاتورة مبيعات رقم 136 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='136',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=136' WHERE id = '979';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '597.60', '597.60', '2026-09-28', '1', '0', '979', '2026-09-28 14:11:31','تم عكس القيد رقم 979 ','1','0','0','0','0',''); -- id=1051
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1051', '402', '597.60', '','0'); -- id=1051
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '533906.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 ('1051', '382', '597.60', '','0'); -- id=1051
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2501196.62', 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 ( '1438', '1438', '2026-09-28', '1', '0', '0', '2026-09-28 14:11:31','اضافة فاتورة مبيعات رقم 156','1','0',null,'0','156','sellbillController.php?do=showDetail&sellbillid=156'); -- id=1052
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1052', '447', '1438', '','0'); -- id=1052
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '1958', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:42:27' WHERE id = '447';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1052', '143', '1438', '','0'); -- id=1052
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '578770.82', 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 ( '1313.6', '1313.6', '2026-09-28', '1', '0', '0', '2026-09-28 14:11:31','اضافة فاتورة مبيعات رقم 156 - صرف البضاعة من المخزن','1','0',null,'0','156','sellbillController.php?do=showDetail&sellbillid=156'); -- id=1053
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1053', '402', '1313.6', '','0'); -- id=1053
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '535219.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 ('1053', '382', '1313.6', '','0'); -- id=1053
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2499883.02', 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='1052,0,1053' where sellbillid=156;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 1438, 1313.6, 1313.6
                    , 1268.85, 1313.6, 1268.85, 1286.06
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1313.6, 1268.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1438, sellCostBuyPrice =sellCostBuyPrice+1313.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1313.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1268.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1313.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1268.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1286.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1313.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1268.85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-28', 1438, 1313.6, 1313.6
                    , 1268.85, 1313.6, 1268.85, 1286.06
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1313.6, 1268.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1438, sellCostBuyPrice =sellCostBuyPrice+1313.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1313.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1268.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1313.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1268.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1286.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1313.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1268.85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1438, 1313.6, 1313.6
                    , 1268.85, 1313.6, 1268.85, 1286.06, 1313.6, 1268.85)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1438, netSellCostBuyPrice = netSellCostBuyPrice+1313.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1313.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1268.85
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1313.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1268.85
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1286.06
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1313.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1268.85;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 136 and newid=156 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:41:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:11:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:11:32', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=156'); -- id=2719
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:42:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:12:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 14:12:04', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2720
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:42:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:12:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 14:12:26', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2721
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:43:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:13:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:13:26', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=156'); -- id=2722
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:43:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:13:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:13:59', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2723
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:44:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:14:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 14:14:04', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2724
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:44:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:14:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-28 14:14:06', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=2725
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:44:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:14:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-28 14:14:07', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2726
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:44:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:14:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 14:14:26', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2727
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:53:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:23:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-09-28 14:23:39', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php'); -- id=2728
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:53:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:23:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-09-28 14:23:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php?do=show'); -- id=2729
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:54:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:24:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-09-28 14:24:39', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php?do=show'); -- id=2730
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:54:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:24:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-09-28 14:24:54', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php?do=show'); -- id=2731
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 10:55:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 14:25:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-09-28 14:25:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php?do=show'); -- id=2732
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:02:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:32:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 15:32:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2733
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:02:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:32:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 15:32:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2734
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:02:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:32:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 15:32:31', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=150'); -- id=2735
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:06:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:36:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 15:36:44', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2736
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:06:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:36:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-28 15:36:47', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=2737
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:08:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:38:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-28 15:38:23', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=2738
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-09-28' WHERE storedetailid = '29';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('29', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '11', '12', '1', '2026-09-28','0','0'); -- id=2153
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '200', '200', '2026-09-28', '1', '0', '0', '2026-09-28 15:38:24','اعادة جرد للمنتج : (قطعه بروفايل24 وات 60 سنتي /ماجنتيك) فى مخزن : (المخزن الرئيسي) بالكمية : 12','1','0',null,'0','2153','inventoryController.php?do=details&id=2153'); -- id=1054
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1054', '382', '200', '','0'); -- id=1054
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2500083.02', 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 ('1054', '188', '200', '','0'); -- id=1054
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-59157.75', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:16:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:46:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 15:46:05', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2739
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 150;
UPDATE sellbill SET  sellbillsysdate = '2026-09-28 15:46:09', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '150';
UPDATE sellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where sellbilldetailid = 1013;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 8100, 7912.5, 7912.5
                    , 7912.5, 7912.5, 7912.5, 7912.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,150,0, 7912.5, 7912.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8100, sellCostBuyPrice =sellCostBuyPrice-7912.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7912.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7912.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7912.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7912.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7912.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7912.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7912.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-150
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 8100, 7912.5, 7912.5
                    , 7912.5, 7912.5, 7912.5, 7912.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7912.5, 7912.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8100, sellCostBuyPrice =sellCostBuyPrice-7912.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7912.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7912.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7912.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7912.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7912.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7912.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7912.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 = '534', userid = '1', storedetaildate = '2026-09-28 15:46:09' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '150', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '384', '534', '1', '2026-09-28 10:08:10','0','0'); -- id=2154
UPDATE sellbilldetail SET  lastbuyprice = 221.00 , meanbuyprice = 221.00, lastbuyprice_withDiscount = 221.00, meanbuyprice_withDiscount = 221.00
        , lastbuyprice_withTax = 221, meanbuyprice_withTax = 221, lastbuyprice_withDiscountAndTax = 221
                where sellbilldetailid = 1014;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (20, '2026-09-28', 2070, 1989, 1989
                    , 1989, 1989, 1989, 1989
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 1989, 1989, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2070, sellCostBuyPrice =sellCostBuyPrice-1989
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1989, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1989
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1989, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1989
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1989
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1989
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1989
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2070, 1989, 1989
                    , 1989, 1989, 1989, 1989
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1989, 1989, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2070, sellCostBuyPrice =sellCostBuyPrice-1989
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1989, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1989
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1989, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1989
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1989
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1989
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1989
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-09-28 15:46:09' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '9', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1', '10', '1', '2026-09-28 10:08:10','0','0'); -- id=2155
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-7 where id = 69;
UPDATE sellbilldetail SET  lastbuyprice = 237.00 , meanbuyprice = 237.00, lastbuyprice_withDiscount = 237.00, meanbuyprice_withDiscount = 237.00
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where sellbilldetailid = 1015;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-09-28', 1725.5, 1659, 1659
                    , 1659, 1659, 1659, 1659
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 1659, 1659, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1725.5, sellCostBuyPrice =sellCostBuyPrice-1659
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1659, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1659
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1659, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1659
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1659
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1659
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1659
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-28', 1725.5, 1659, 1659
                    , 1659, 1659, 1659, 1659
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1659, 1659, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1725.5, sellCostBuyPrice =sellCostBuyPrice-1659
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1659, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1659
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1659, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1659
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1659
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1659
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1659
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '86', userid = '1', storedetaildate = '2026-09-28 15:46:09' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '7', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '79', '86', '1', '2026-09-28 10:08:10','0','0'); -- id=2156
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-7 where id = 57;
UPDATE sellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where sellbilldetailid = 1016;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-09-28', 1190, 1141, 1141
                    , 1141, 1141, 1141, 1141
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 1141, 1141, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1190, sellCostBuyPrice =sellCostBuyPrice-1141
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1141, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1141
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1141, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1141
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1141
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1141
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1141
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-09-28', 1190, 1141, 1141
                    , 1141, 1141, 1141, 1141
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1141, 1141, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1190, sellCostBuyPrice =sellCostBuyPrice-1141
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1141, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1141
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1141, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1141
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1141
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1141
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1141
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '104', userid = '1', storedetaildate = '2026-09-28 15:46:09' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '7', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '97', '104', '1', '2026-09-28 10:08:10','0','0'); -- id=2157
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 50;
UPDATE sellbilldetail SET  lastbuyprice = 1282.00 , meanbuyprice = 1271.33, lastbuyprice_withDiscount = 1282.00, meanbuyprice_withDiscount = 1271.33
        , lastbuyprice_withTax = 1282, meanbuyprice_withTax = 1271.33, lastbuyprice_withDiscountAndTax = 1282
                where sellbilldetailid = 1017;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (202, '2026-09-28', 1850, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1850, sellCostBuyPrice =sellCostBuyPrice-1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1271.33
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1850, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1850, sellCostBuyPrice =sellCostBuyPrice-1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1271.33
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-09-28 15:46:09' WHERE storedetailid = '202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('202', '1', '1', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '6', '7', '1', '2026-09-28 10:08:10','0','0'); -- id=2158
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 = 1018;
 INSERT INTO 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-09-28', 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-09-28', 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 = '124', userid = '1', storedetaildate = '2026-09-28 15:46:09' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '116', '124', '1', '2026-09-28 10:08:10','0','0'); -- id=2159
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-20 where id = 62;
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1019;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2180, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2180, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '169', userid = '1', storedetaildate = '2026-09-28 15:46:09' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '20', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '149', '169', '1', '2026-09-28 10:08:10','0','0'); -- id=2160
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-20 where id = 63;
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1020;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2180, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2180, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '133', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '20', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '113', '133', '1', '2026-09-28 10:08:10','0','0'); -- id=2161
UPDATE sellbilldetail SET  lastbuyprice = 156.00 , meanbuyprice = 156.00, lastbuyprice_withDiscount = 156.00, meanbuyprice_withDiscount = 156.00
        , lastbuyprice_withTax = 156, meanbuyprice_withTax = 156, lastbuyprice_withDiscountAndTax = 156
                where sellbilldetailid = 1021;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (21, '2026-09-28', 818.1, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-818.1, sellCostBuyPrice =sellCostBuyPrice-780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-780
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 818.1, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-818.1, sellCostBuyPrice =sellCostBuyPrice-780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-780, sellCostMeanBuyPrice = sellCostMeanBuyPrice-780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-780
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '21';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('21', '1', '5', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '5', '1', '2026-09-28 10:08:10','0','0'); -- id=2162
UPDATE sellbilldetail SET  lastbuyprice = 60.00 , meanbuyprice = 60.00, lastbuyprice_withDiscount = 60.00, meanbuyprice_withDiscount = 60.00
        , lastbuyprice_withTax = 60, meanbuyprice_withTax = 60, lastbuyprice_withDiscountAndTax = 60
                where sellbilldetailid = 1022;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (298, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-75, sellCostBuyPrice =sellCostBuyPrice-60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-60, sellCostMeanBuyPrice = sellCostMeanBuyPrice-60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-60
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-75, sellCostBuyPrice =sellCostBuyPrice-60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-60, sellCostMeanBuyPrice = sellCostMeanBuyPrice-60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-60
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '1', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9', '10', '1', '2026-09-28 10:08:10','0','0'); -- id=2163
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 67;
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1023;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (16, '2026-09-28', 67, 63, 63
                    , 63, 63, 63, 63
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 63, 63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-67, sellCostBuyPrice =sellCostBuyPrice-63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-63, sellCostMeanBuyPrice = sellCostMeanBuyPrice-63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-63
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-63
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 67, 63, 63
                    , 63, 63, 63, 63
                    , 0, 0, 0, 0
                    , 0, 0, 0, 63, 63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-67, sellCostBuyPrice =sellCostBuyPrice-63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-63, sellCostMeanBuyPrice = sellCostMeanBuyPrice-63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-63
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-63
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '125', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '16';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('16', '1', '1', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '124', '125', '1', '2026-09-28 10:08:10','0','0'); -- id=2164
UPDATE sellbilldetail SET  lastbuyprice = 14.70 , meanbuyprice = 14.70, lastbuyprice_withDiscount = 14.70, meanbuyprice_withDiscount = 14.70
        , lastbuyprice_withTax = 14.7, meanbuyprice_withTax = 14.7, lastbuyprice_withDiscountAndTax = 14.7
                where sellbilldetailid = 1024;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (136, '2026-09-28', 2278.5, 2278.5, 2278.5
                    , 2278.5, 2278.5, 2278.5, 2278.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,155,0, 2278.5, 2278.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2278.5, sellCostBuyPrice =sellCostBuyPrice-2278.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2278.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2278.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2278.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2278.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2278.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2278.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2278.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-155
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2278.5, 2278.5, 2278.5
                    , 2278.5, 2278.5, 2278.5, 2278.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2278.5, 2278.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2278.5, sellCostBuyPrice =sellCostBuyPrice-2278.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2278.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2278.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2278.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2278.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2278.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2278.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2278.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 = '212', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '136';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('136', '1', '155', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '57', '212', '1', '2026-09-28 10:08:10','0','0'); -- id=2165
UPDATE sellbilldetail SET  lastbuyprice = 41.28 , meanbuyprice = 41.28, lastbuyprice_withDiscount = 41.28, meanbuyprice_withDiscount = 41.28
        , lastbuyprice_withTax = 41.28, meanbuyprice_withTax = 41.28, lastbuyprice_withDiscountAndTax = 41.28
                where sellbilldetailid = 1025;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (187, '2026-09-28', 7440, 6398.4, 6398.4
                    , 6398.4, 6398.4, 6398.4, 6398.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,155,0, 6398.4, 6398.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7440, sellCostBuyPrice =sellCostBuyPrice-6398.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6398.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6398.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6398.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6398.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6398.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6398.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6398.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-155
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 7440, 6398.4, 6398.4
                    , 6398.4, 6398.4, 6398.4, 6398.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6398.4, 6398.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7440, sellCostBuyPrice =sellCostBuyPrice-6398.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6398.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6398.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6398.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6398.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6398.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6398.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6398.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 = '511', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('187', '1', '155', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '356', '511', '1', '2026-09-28 10:08:10','0','0'); -- id=2166
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1026;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0,100,0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3575, sellCostBuyPrice =sellCostBuyPrice-3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3480
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-100
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3575, sellCostBuyPrice =sellCostBuyPrice-3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3480
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1718', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '100', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1618', '1718', '1', '2026-09-28 10:08:10','0','0'); -- id=2167
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1027;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0,100,0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3575, sellCostBuyPrice =sellCostBuyPrice-3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3480
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-100
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3575, sellCostBuyPrice =sellCostBuyPrice-3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3480
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1471', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '100', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1371', '1471', '1', '2026-09-28 10:08:10','0','0'); -- id=2168
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1028;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-09-28', 792, 756, 756
                    , 756, 756, 756, 756
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 756, 756, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-792, sellCostBuyPrice =sellCostBuyPrice-756
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-756, sellCostMeanBuyPrice = sellCostMeanBuyPrice-756
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-756
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-756
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-756
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 792, 756, 756
                    , 756, 756, 756, 756
                    , 0, 0, 0, 0
                    , 0, 0, 0, 756, 756, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-792, sellCostBuyPrice =sellCostBuyPrice-756
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-756, sellCostMeanBuyPrice = sellCostMeanBuyPrice-756
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-756
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-756
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-756
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '91', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '12', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '79', '91', '1', '2026-09-28 10:08:10','0','0'); -- id=2169
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 1029;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-09-28', 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-09-28', 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 = '518', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '508', '518', '1', '2026-09-28 10:08:10','0','0'); -- id=2170
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 1030;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 2190, 2110, 2110
                    , 2110, 2110, 2110, 2110
                    , 0, 0, 0, 0
                    , 0, 0, 0,200,0, 2110, 2110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2190, sellCostBuyPrice =sellCostBuyPrice-2110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2110, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2110
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-200
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2190, 2110, 2110
                    , 2110, 2110, 2110, 2110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2110, 2110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2190, sellCostBuyPrice =sellCostBuyPrice-2110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2110, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2110
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1329', userid = '1', storedetaildate = '2026-09-28 15:46:10' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '200', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1129', '1329', '1', '2026-09-28 10:08:10','0','0'); -- id=2171
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 17;
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 1031;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-09-28', 375, 347.5, 347.5
                    , 343.9, 347.5, 343.9, 347.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 347.5, 343.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-375, sellCostBuyPrice =sellCostBuyPrice-347.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-347.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-343.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-347.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-343.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-347.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-347.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-343.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 375, 347.5, 347.5
                    , 343.9, 347.5, 343.9, 347.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 347.5, 343.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-375, sellCostBuyPrice =sellCostBuyPrice-347.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-347.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-343.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-347.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-343.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-347.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-347.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-343.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '65', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '5', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '60', '65', '1', '2026-09-28 10:08:10','0','0'); -- id=2172
UPDATE sellbilldetail SET  lastbuyprice = 252.00 , meanbuyprice = 252.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 252, meanbuyprice_withTax = 252, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1032;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (288, '2026-09-28', 1180, 1008, 1008
                    , 1008, 1008, 1008, 1008
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 1008, 1008, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1180, sellCostBuyPrice =sellCostBuyPrice-1008
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1008, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1008
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1008, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1008
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1008
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1008
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1008
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1180, 1008, 1008
                    , 1008, 1008, 1008, 1008
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1008, 1008, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1180, sellCostBuyPrice =sellCostBuyPrice-1008
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1008, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1008
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1008, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1008
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1008
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1008
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1008
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '288';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('288', '1', '4', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '25', '29', '1', '2026-09-28 10:08:10','0','0'); -- id=2173
UPDATE sellbilldetail SET  lastbuyprice = 76.50 , meanbuyprice = 76.50, lastbuyprice_withDiscount = 76.50, meanbuyprice_withDiscount = 76.50
        , lastbuyprice_withTax = 76.5, meanbuyprice_withTax = 76.5, lastbuyprice_withDiscountAndTax = 76.5
                where sellbilldetailid = 1033;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (320, '2026-09-28', 595, 535.5, 535.5
                    , 535.5, 535.5, 535.5, 535.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 535.5, 535.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-595, sellCostBuyPrice =sellCostBuyPrice-535.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-535.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-535.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-535.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-535.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-535.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-535.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-535.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-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-09-28', 595, 535.5, 535.5
                    , 535.5, 535.5, 535.5, 535.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 535.5, 535.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-595, sellCostBuyPrice =sellCostBuyPrice-535.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-535.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-535.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-535.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-535.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-535.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-535.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-535.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 = '25', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '7', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '18', '25', '1', '2026-09-28 10:08:10','0','0'); -- id=2174
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 = 1034;
 INSERT INTO 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-09-28', 952, 907.9, 907.9
                    , 907.9, 907.9, 907.9, 907.9
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 907.9, 907.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-952, sellCostBuyPrice =sellCostBuyPrice-907.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-907.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-907.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-907.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-907.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-907.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-907.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-907.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-09-28', 952, 907.9, 907.9
                    , 907.9, 907.9, 907.9, 907.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 907.9, 907.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-952, sellCostBuyPrice =sellCostBuyPrice-907.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-907.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-907.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-907.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-907.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-907.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-907.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-907.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '62';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '1', '7', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '31', '1', '2026-09-28 10:08:10','0','0'); -- id=2175
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 = 1035;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (61, '2026-09-28', 816, 778.2, 778.2
                    , 778.2, 778.2, 778.2, 778.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 778.2, 778.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-816, sellCostBuyPrice =sellCostBuyPrice-778.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-778.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-778.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-778.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-778.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-778.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-778.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-778.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-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 816, 778.2, 778.2
                    , 778.2, 778.2, 778.2, 778.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 778.2, 778.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-816, sellCostBuyPrice =sellCostBuyPrice-778.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-778.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-778.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-778.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-778.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-778.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-778.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-778.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 = '60', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '61';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('61', '1', '6', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '54', '60', '1', '2026-09-28 10:08:10','0','0'); -- id=2176
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 = 1036;
 INSERT INTO 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-09-28', 2040, 1945.5, 1945.5
                    , 1945.5, 1945.5, 1945.5, 1945.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 1945.5, 1945.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2040, sellCostBuyPrice =sellCostBuyPrice-1945.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1945.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1945.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1945.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1945.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1945.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1945.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1945.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2040, 1945.5, 1945.5
                    , 1945.5, 1945.5, 1945.5, 1945.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1945.5, 1945.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2040, sellCostBuyPrice =sellCostBuyPrice-1945.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1945.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1945.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1945.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1945.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1945.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1945.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1945.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 = '177', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '59';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('59', '1', '15', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '162', '177', '1', '2026-09-28 10:08:10','0','0'); -- id=2177
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 = 1037;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (60, '2026-09-28', 1088, 1037.6, 1037.6
                    , 1037.6, 1037.6, 1037.6, 1037.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 1037.6, 1037.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1088, sellCostBuyPrice =sellCostBuyPrice-1037.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1037.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1037.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1037.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1037.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1037.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1037.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1037.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-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-09-28', 1088, 1037.6, 1037.6
                    , 1037.6, 1037.6, 1037.6, 1037.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1037.6, 1037.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1088, sellCostBuyPrice =sellCostBuyPrice-1037.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1037.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1037.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1037.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1037.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1037.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1037.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1037.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 = '51', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '60';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('60', '1', '8', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '43', '51', '1', '2026-09-28 10:08:10','0','0'); -- id=2178
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-10 where id = 71;
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 = 1038;
 INSERT INTO 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-09-28', 3190, 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-3190, 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-09-28', 3190, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3190, 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 = '66', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '10', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '56', '66', '1', '2026-09-28 10:08:10','0','0'); -- id=2179
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1039;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (283, '2026-09-28', 1675, 1375, 1375
                    , 1375, 1375, 1375, 1375
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1375, 1375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1675, sellCostBuyPrice =sellCostBuyPrice-1375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1375, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1375
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1675, 1375, 1375
                    , 1375, 1375, 1375, 1375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1375, 1375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1675, sellCostBuyPrice =sellCostBuyPrice-1375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1375, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1375
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '283';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '1', '5', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '8', '1', '2026-09-28 10:08:10','0','0'); -- id=2180
UPDATE sellbilldetail SET  lastbuyprice = 137.00 , meanbuyprice = 137.00, lastbuyprice_withDiscount = 137.00, meanbuyprice_withDiscount = 137.00
        , lastbuyprice_withTax = 137, meanbuyprice_withTax = 137, lastbuyprice_withDiscountAndTax = 137
                where sellbilldetailid = 1040;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (427, '2026-09-28', 1125, 685, 685
                    , 685, 685, 685, 685
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 685, 685, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1125, sellCostBuyPrice =sellCostBuyPrice-685
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-685, sellCostMeanBuyPrice = sellCostMeanBuyPrice-685
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-685, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-685
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-685
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-685
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-685
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1125, 685, 685
                    , 685, 685, 685, 685
                    , 0, 0, 0, 0
                    , 0, 0, 0, 685, 685, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1125, sellCostBuyPrice =sellCostBuyPrice-685
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-685, sellCostMeanBuyPrice = sellCostMeanBuyPrice-685
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-685, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-685
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-685
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-685
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-685
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-09-28 15:46:11' WHERE storedetailid = '427';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('427', '1', '5', '0', '150', 'تعديل فاتورة مبيعات', 'sellbillController.php', '45', '50', '1', '2026-09-28 10:08:10','0','0'); -- id=2181
CALL clientInUse(39,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '39';
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 ('39','53452.10','53452.10','1','تعديل فاتورة مبيعات','150', '0', '2026-09-28 10:08:10', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '53452.1', '0', null, '0', null, null,'', '0','1','1','53452.1','1','2026-09-28 10:08:10','0','0','',''); -- id=264
UPDATE client SET  inUse = 0 where clientid = 39;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 53452.1, 49537.6, 49537.6
                    , 49523.33, 49537.6, 49523.33, 49537.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,49537.6, 49523.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-53452.1, sellCostBuyPrice =sellCostBuyPrice-49537.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-49537.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-49523.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-49537.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-49523.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-49537.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-49537.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-49523.33
                        , returnSellVal = returnSellVal-0, 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 (39, '2026-09-28', 53452.1, 49537.6, 49537.6
                    , 49523.33, 49537.6, 49523.33, 49537.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 49537.6, 49523.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-53452.1, sellCostBuyPrice =sellCostBuyPrice-49537.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-49537.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-49523.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-49537.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-49523.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-49537.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-49537.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-49523.33
                        , returnSellVal = returnSellVal-0, 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, 53452.1, 49537.6, 49537.6
                    , 49523.33, 49537.6, 49523.33, 49537.6, 49537.6, 49523.33)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-53452.1, netSellCostBuyPrice = netSellCostBuyPrice-49537.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-49537.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-49523.33
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-49537.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-49523.33
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-49537.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-49537.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-49523.33;

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


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

COMMIT;
BEGIN;
CALL clientInUse(39,@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-28 10:08:10', '06aba11ecee4ec', '39', '0.00', '61317.1', '0', '1', '61317.1', '61317.1', '0', '61317.1', '1', '2026-09-28 10:08:10', '', '1', '0', 'محمد عباس الطوخي', '1', '1', '3', '0', 'محمد عباس الطوخي', '1060', '150', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-28','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=157
UPDATE client SET  clientdebt = '61317.1', userid = '1' WHERE clientid = '39';
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 ('39','0.00','61317.1','0','اضافة فاتورة مبيعات (معدله)','157', '61317.1', '2026-09-28 15:46:12', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '61317.1', '0', null, '0', null, null,'', '0','1','1','53452.1','1','2026-09-28 10:08:10','0','0','',''); -- id=265
UPDATE client SET  inUse = 0 where clientid = 39;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.75','00001', '157', '1', '1', '150.00', '54', '8100', '0', '', '1', '2026-09-28 15:46:13', '1', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54','8100','0','','0','0.00','0','0','0','0'); -- id=1073
UPDATE sellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where sellbilldetailid = 1073;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 8100, 7912.5, 7912.5
                    , 7912.5, 7912.5, 7912.5, 7912.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 150, 0, 7912.5, 7912.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8100, sellCostBuyPrice =sellCostBuyPrice+7912.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7912.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7912.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7912.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7912.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7912.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7912.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7912.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+150
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 8100, 7912.5, 7912.5
                    , 7912.5, 7912.5, 7912.5, 7912.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7912.5, 7912.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8100, sellCostBuyPrice =sellCostBuyPrice+7912.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7912.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7912.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7912.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7912.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7912.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7912.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7912.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 = '384', userid = '1', storedetaildate = '2026-09-28 15:46:13' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '150', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '534', '384', '1', '2026-09-28 15:46:13','0','0'); -- id=2182
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('221','00020', '157', '1', '20', '9.00', '230', '2070', '0', '', '1', '2026-09-28 15:46:13', '20', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','230','2070','0','','0','0.00','0','0','0','0'); -- id=1074
UPDATE sellbilldetail SET  lastbuyprice = 221.00 , meanbuyprice = 221.00, lastbuyprice_withDiscount = 221.00, meanbuyprice_withDiscount = 221.00
        , lastbuyprice_withTax = 221, meanbuyprice_withTax = 221, lastbuyprice_withDiscountAndTax = 221
                where sellbilldetailid = 1074;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (20, '2026-09-28', 2070, 1989, 1989
                    , 1989, 1989, 1989, 1989
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 1989, 1989, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2070, sellCostBuyPrice =sellCostBuyPrice+1989
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1989, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1989
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1989, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1989
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1989
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1989
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1989
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2070, 1989, 1989
                    , 1989, 1989, 1989, 1989
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1989, 1989, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2070, sellCostBuyPrice =sellCostBuyPrice+1989
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1989, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1989
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1989, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1989
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1989
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1989
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1989
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-28 15:46:13' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '9', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '1', '1', '2026-09-28 15:46:13','0','0'); -- id=2183
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 69;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237','00010', '157', '1', '10', '7.00', '246.5', '1725.5', '0', '', '1', '2026-09-28 15:46:13', '10', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','69-7,','1','1','0','0','246.5','1725.5','0','','0','0.00','0','0','0','0'); -- id=1075
UPDATE sellbilldetail SET  lastbuyprice = 237.00 , meanbuyprice = 237.00, lastbuyprice_withDiscount = 237.00, meanbuyprice_withDiscount = 237.00
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where sellbilldetailid = 1075;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-09-28', 1725.5, 1659, 1659
                    , 1659, 1659, 1659, 1659
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 1659, 1659, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1725.5, sellCostBuyPrice =sellCostBuyPrice+1659
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1659, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1659
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1659, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1659
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1659
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1659
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1659
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-28', 1725.5, 1659, 1659
                    , 1659, 1659, 1659, 1659
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1659, 1659, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1725.5, sellCostBuyPrice =sellCostBuyPrice+1659
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1659, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1659
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1659, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1659
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1659
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1659
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1659
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '79', userid = '1', storedetaildate = '2026-09-28 15:46:13' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '7', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '86', '79', '1', '2026-09-28 15:46:14','0','0'); -- id=2184
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 57;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('163','00015', '157', '1', '15', '7.00', '170', '1190', '0', '', '1', '2026-09-28 15:46:14', '15', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','57-7,','1','1','0','0','170','1190','0','','0','0.00','0','0','0','0'); -- id=1076
UPDATE sellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where sellbilldetailid = 1076;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-09-28', 1190, 1141, 1141
                    , 1141, 1141, 1141, 1141
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 1141, 1141, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1190, sellCostBuyPrice =sellCostBuyPrice+1141
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1141, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1141
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1141, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1141
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1141
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1141
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1141
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-09-28', 1190, 1141, 1141
                    , 1141, 1141, 1141, 1141
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1141, 1141, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1190, sellCostBuyPrice =sellCostBuyPrice+1141
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1141, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1141
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1141, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1141
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1141
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1141
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1141
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '97', userid = '1', storedetaildate = '2026-09-28 15:46:14' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '7', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '104', '97', '1', '2026-09-28 15:46:14','0','0'); -- id=2185
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 50;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1282','00202', '157', '6', '202', '1.00', '1850', '1850', '0', '', '1', '2026-09-28 15:46:14', '202', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','50-1,','1','1','0','0','1850','1850','0','','0','0.00','0','0','0','0'); -- id=1077
UPDATE sellbilldetail SET  lastbuyprice = 1282.00 , meanbuyprice = 1271.33, lastbuyprice_withDiscount = 1282.00, meanbuyprice_withDiscount = 1271.33
        , lastbuyprice_withTax = 1282, meanbuyprice_withTax = 1271.33, lastbuyprice_withDiscountAndTax = 1282
                where sellbilldetailid = 1077;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (202, '2026-09-28', 1850, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1850, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1850, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1850, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-09-28 15:46:14' WHERE storedetailid = '202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('202', '1', '1', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '7', '6', '1', '2026-09-28 15:46:14','0','0'); -- id=2186
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '157', '6', '207', '8.00', '15', '120', '0', '', '1', '2026-09-28 15:46:14', '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=1078
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 = 1078;
 INSERT INTO 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-09-28', 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-09-28', 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 = '116', userid = '1', storedetaildate = '2026-09-28 15:46:15' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '116', '1', '2026-09-28 15:46:15','0','0'); -- id=2187
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 62;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00006', '157', '1', '6', '20.00', '109', '2180', '0', '', '1', '2026-09-28 15:46:15', '6', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','62-20,','1','1','0','0','109','2180','0','','0','0.00','0','0','0','0'); -- id=1079
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1079;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '149', userid = '1', storedetaildate = '2026-09-28 15:46:15' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '20', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '169', '149', '1', '2026-09-28 15:46:15','0','0'); -- id=2188
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 63;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00011', '157', '1', '11', '20.00', '109', '2180', '0', '', '1', '2026-09-28 15:46:15', '11', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','63-20,','1','1','0','0','109','2180','0','','0','0.00','0','0','0','0'); -- id=1080
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 1080;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2180, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2180, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '113', userid = '1', storedetaildate = '2026-09-28 15:46:15' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '20', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '133', '113', '1', '2026-09-28 15:46:15','0','0'); -- id=2189
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('156','00021', '157', '1', '21', '5.00', '163.62', '818.1', '0', '', '1', '2026-09-28 15:46:15', '21', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','163.62','818.1','0','','0','0.00','0','0','0','0'); -- id=1081
UPDATE sellbilldetail SET  lastbuyprice = 156.00 , meanbuyprice = 156.00, lastbuyprice_withDiscount = 156.00, meanbuyprice_withDiscount = 156.00
        , lastbuyprice_withTax = 156, meanbuyprice_withTax = 156, lastbuyprice_withDiscountAndTax = 156
                where sellbilldetailid = 1081;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (21, '2026-09-28', 818.1, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+818.1, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 818.1, 780, 780
                    , 780, 780, 780, 780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 780, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+818.1, sellCostBuyPrice =sellCostBuyPrice+780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-28 15:46:16' WHERE storedetailid = '21';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('21', '1', '5', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '0', '1', '2026-09-28 15:46:16','0','0'); -- id=2190
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('60','00298', '157', '6', '298', '1.00', '75', '75', '0', '', '1', '2026-09-28 15:46:16', '298', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','75','75','0','','0','0.00','0','0','0','0'); -- id=1082
UPDATE sellbilldetail SET  lastbuyprice = 60.00 , meanbuyprice = 60.00, lastbuyprice_withDiscount = 60.00, meanbuyprice_withDiscount = 60.00
        , lastbuyprice_withTax = 60, meanbuyprice_withTax = 60, lastbuyprice_withDiscountAndTax = 60
                where sellbilldetailid = 1082;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (298, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-09-28 15:46:16' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '1', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '9', '1', '2026-09-28 15:46:16','0','0'); -- id=2191
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 67;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('63','00016', '157', '1', '16', '1.00', '67', '67', '0', '', '1', '2026-09-28 15:46:16', '16', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','67-1,','1','1','0','0','67','67','0','','0','0.00','0','0','0','0'); -- id=1083
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1083;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (16, '2026-09-28', 67, 63, 63
                    , 63, 63, 63, 63
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 63, 63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+67, sellCostBuyPrice =sellCostBuyPrice+63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+63, sellCostMeanBuyPrice = sellCostMeanBuyPrice+63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+63
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 67, 63, 63
                    , 63, 63, 63, 63
                    , 0, 0, 0, 0
                    , 0, 0, 0, 63, 63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+67, sellCostBuyPrice =sellCostBuyPrice+63
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+63, sellCostMeanBuyPrice = sellCostMeanBuyPrice+63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+63, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+63
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+63
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-09-28 15:46:16' WHERE storedetailid = '16';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('16', '1', '1', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '125', '124', '1', '2026-09-28 15:46:16','0','0'); -- id=2192
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14.7','00136', '157', '21', '136', '155.00', '14.7', '2278.5', '0', '', '1', '2026-09-28 15:46:16', '136', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14.7','2278.5','0','','0','0.00','0','0','0','0'); -- id=1084
UPDATE sellbilldetail SET  lastbuyprice = 14.70 , meanbuyprice = 14.70, lastbuyprice_withDiscount = 14.70, meanbuyprice_withDiscount = 14.70
        , lastbuyprice_withTax = 14.7, meanbuyprice_withTax = 14.7, lastbuyprice_withDiscountAndTax = 14.7
                where sellbilldetailid = 1084;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (136, '2026-09-28', 2278.5, 2278.5, 2278.5
                    , 2278.5, 2278.5, 2278.5, 2278.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 155, 0, 2278.5, 2278.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2278.5, sellCostBuyPrice =sellCostBuyPrice+2278.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2278.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2278.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2278.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2278.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2278.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2278.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2278.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+155
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2278.5, 2278.5, 2278.5
                    , 2278.5, 2278.5, 2278.5, 2278.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2278.5, 2278.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2278.5, sellCostBuyPrice =sellCostBuyPrice+2278.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2278.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2278.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2278.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2278.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2278.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2278.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2278.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 = '57', userid = '1', storedetaildate = '2026-09-28 15:46:17' WHERE storedetailid = '136';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('136', '1', '155', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '212', '57', '1', '2026-09-28 15:46:17','0','0'); -- id=2193
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('41.28','00187', '157', '20', '187', '155.00', '48', '7440', '0', '', '1', '2026-09-28 15:46:17', '187', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','7440','0','','0','0.00','0','0','0','0'); -- id=1085
UPDATE sellbilldetail SET  lastbuyprice = 41.28 , meanbuyprice = 41.28, lastbuyprice_withDiscount = 41.28, meanbuyprice_withDiscount = 41.28
        , lastbuyprice_withTax = 41.28, meanbuyprice_withTax = 41.28, lastbuyprice_withDiscountAndTax = 41.28
                where sellbilldetailid = 1085;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (187, '2026-09-28', 7440, 6398.4, 6398.4
                    , 6398.4, 6398.4, 6398.4, 6398.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 155, 0, 6398.4, 6398.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7440, sellCostBuyPrice =sellCostBuyPrice+6398.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6398.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6398.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6398.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6398.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6398.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6398.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6398.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+155
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 7440, 6398.4, 6398.4
                    , 6398.4, 6398.4, 6398.4, 6398.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6398.4, 6398.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7440, sellCostBuyPrice =sellCostBuyPrice+6398.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6398.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6398.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6398.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6398.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6398.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6398.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6398.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 = '356', userid = '1', storedetaildate = '2026-09-28 15:46:17' WHERE storedetailid = '187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('187', '1', '155', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '511', '356', '1', '2026-09-28 15:46:17','0','0'); -- id=2194
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00004', '157', '1', '4', '100.00', '35.75', '3575', '0', '', '1', '2026-09-28 15:46:17', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','35.75','3575','0','','0','0.00','0','0','0','0'); -- id=1086
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1086;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+100
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1618', userid = '1', storedetaildate = '2026-09-28 15:46:17' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '100', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1718', '1618', '1', '2026-09-28 15:46:17','0','0'); -- id=2195
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00003', '157', '1', '3', '100.00', '35.75', '3575', '0', '', '1', '2026-09-28 15:46:17', '3', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','35.75','3575','0','','0','0.00','0','0','0','0'); -- id=1087
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 1087;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+100
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 3575, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3575, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1371', userid = '1', storedetaildate = '2026-09-28 15:46:18' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '100', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1471', '1371', '1', '2026-09-28 15:46:18','0','0'); -- id=2196
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('63','00012', '157', '1', '12', '12.00', '66', '792', '0', '', '1', '2026-09-28 15:46:18', '12', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','66','792','0','','0','0.00','0','0','0','0'); -- id=1088
UPDATE sellbilldetail SET  lastbuyprice = 63.00 , meanbuyprice = 63.00, lastbuyprice_withDiscount = 63.00, meanbuyprice_withDiscount = 63.00
        , lastbuyprice_withTax = 63, meanbuyprice_withTax = 63, lastbuyprice_withDiscountAndTax = 63
                where sellbilldetailid = 1088;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (12, '2026-09-28', 792, 756, 756
                    , 756, 756, 756, 756
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 756, 756, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+792, sellCostBuyPrice =sellCostBuyPrice+756
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+756, sellCostMeanBuyPrice = sellCostMeanBuyPrice+756
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+756
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+756
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+756
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 792, 756, 756
                    , 756, 756, 756, 756
                    , 0, 0, 0, 0
                    , 0, 0, 0, 756, 756, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+792, sellCostBuyPrice =sellCostBuyPrice+756
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+756, sellCostMeanBuyPrice = sellCostMeanBuyPrice+756
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+756, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+756
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+756
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+756
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+756
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '79', userid = '1', storedetaildate = '2026-09-28 15:46:18' WHERE storedetailid = '12';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('12', '1', '12', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '91', '79', '1', '2026-09-28 15:46:18','0','0'); -- id=2197
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '157', '14', '81', '10.00', '19', '190', '0', '', '1', '2026-09-28 15:46:18', '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=1089
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 = 1089;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-09-28', 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-09-28', 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 = '508', userid = '1', storedetaildate = '2026-09-28 15:46:18' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '518', '508', '1', '2026-09-28 15:46:18','0','0'); -- id=2198
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.55','00005', '157', '1', '5', '200.00', '10.95', '2190', '0', '', '1', '2026-09-28 15:46:18', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','2190','0','','0','0.00','0','0','0','0'); -- id=1090
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 1090;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 2190, 2110, 2110
                    , 2110, 2110, 2110, 2110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200, 0, 2110, 2110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2190, sellCostBuyPrice =sellCostBuyPrice+2110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+200
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2190, 2110, 2110
                    , 2110, 2110, 2110, 2110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2110, 2110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2190, sellCostBuyPrice =sellCostBuyPrice+2110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1129', userid = '1', storedetaildate = '2026-09-28 15:46:19' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '200', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1329', '1129', '1', '2026-09-28 15:46:19','0','0'); -- id=2199
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 17;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('69.5','00318', '157', '7', '318', '5.00', '75', '375', '0', '', '1', '2026-09-28 15:46:19', '318', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','17-5,','1','1','0','0','75','375','0','','0','0.00','0','0','0','0'); -- id=1091
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 1091;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-09-28', 375, 347.5, 347.5
                    , 343.9, 347.5, 343.9, 347.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 347.5, 343.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+375, sellCostBuyPrice =sellCostBuyPrice+347.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+347.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+347.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+347.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+347.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 375, 347.5, 347.5
                    , 343.9, 347.5, 343.9, 347.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 347.5, 343.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+375, sellCostBuyPrice =sellCostBuyPrice+347.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+347.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+343.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+347.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+343.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+347.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+347.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+343.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-09-28 15:46:19' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '5', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '65', '60', '1', '2026-09-28 15:46:19','0','0'); -- id=2200
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('252','00288', '157', '7', '288', '4.00', '295', '1180', '0', '', '1', '2026-09-28 15:46:19', '288', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','1180','0','','0','0.00','0','0','0','0'); -- id=1092
UPDATE sellbilldetail SET  lastbuyprice = 252.00 , meanbuyprice = 252.00, lastbuyprice_withDiscount = 252.00, meanbuyprice_withDiscount = 252.00
        , lastbuyprice_withTax = 252, meanbuyprice_withTax = 252, lastbuyprice_withDiscountAndTax = 252
                where sellbilldetailid = 1092;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (288, '2026-09-28', 1180, 1008, 1008
                    , 1008, 1008, 1008, 1008
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1008, 1008, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1180, sellCostBuyPrice =sellCostBuyPrice+1008
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1008, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1008
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1008, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1008
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1008
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1008
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1008
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1180, 1008, 1008
                    , 1008, 1008, 1008, 1008
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1008, 1008, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1180, sellCostBuyPrice =sellCostBuyPrice+1008
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1008, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1008
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1008, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1008
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1008
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1008
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1008
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-09-28 15:46:19' WHERE storedetailid = '288';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('288', '1', '4', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '29', '25', '1', '2026-09-28 15:46:19','0','0'); -- id=2201
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('76.5','00320', '157', '7', '320', '7.00', '85', '595', '0', '', '1', '2026-09-28 15:46:19', '320', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','595','0','','0','0.00','0','0','0','0'); -- id=1093
UPDATE sellbilldetail SET  lastbuyprice = 76.50 , meanbuyprice = 76.50, lastbuyprice_withDiscount = 76.50, meanbuyprice_withDiscount = 76.50
        , lastbuyprice_withTax = 76.5, meanbuyprice_withTax = 76.5, lastbuyprice_withDiscountAndTax = 76.5
                where sellbilldetailid = 1093;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (320, '2026-09-28', 595, 535.5, 535.5
                    , 535.5, 535.5, 535.5, 535.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 535.5, 535.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+595, sellCostBuyPrice =sellCostBuyPrice+535.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+535.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+535.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+535.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+535.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+535.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+535.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+535.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+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-09-28', 595, 535.5, 535.5
                    , 535.5, 535.5, 535.5, 535.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 535.5, 535.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+595, sellCostBuyPrice =sellCostBuyPrice+535.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+535.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+535.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+535.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+535.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+535.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+535.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+535.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-09-28 15:46:19' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '7', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '18', '1', '2026-09-28 15:46:19','0','0'); -- id=2202
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '157', '1', '62', '7.00', '136', '952', '0', '', '1', '2026-09-28 15:46:19', '62', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','952','0','','0','0.00','0','0','0','0'); -- id=1094
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 = 1094;
 INSERT INTO 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-09-28', 952, 907.9, 907.9
                    , 907.9, 907.9, 907.9, 907.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 907.9, 907.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+952, sellCostBuyPrice =sellCostBuyPrice+907.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+907.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+907.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+907.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+907.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+907.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+907.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+907.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-09-28', 952, 907.9, 907.9
                    , 907.9, 907.9, 907.9, 907.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 907.9, 907.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+952, sellCostBuyPrice =sellCostBuyPrice+907.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+907.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+907.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+907.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+907.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+907.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+907.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+907.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-09-28 15:46:20' WHERE storedetailid = '62';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('62', '1', '7', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '31', '24', '1', '2026-09-28 15:46:20','0','0'); -- id=2203
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('129.7','00061', '157', '1', '61', '6.00', '136', '816', '0', '', '1', '2026-09-28 15:46:20', '61', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','816','0','','0','0.00','0','0','0','0'); -- id=1095
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 = 1095;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (61, '2026-09-28', 816, 778.2, 778.2
                    , 778.2, 778.2, 778.2, 778.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 778.2, 778.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+816, sellCostBuyPrice =sellCostBuyPrice+778.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+778.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+778.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+778.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+778.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+778.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+778.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+778.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+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 816, 778.2, 778.2
                    , 778.2, 778.2, 778.2, 778.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 778.2, 778.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+816, sellCostBuyPrice =sellCostBuyPrice+778.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+778.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+778.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+778.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+778.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+778.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+778.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+778.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 = '54', userid = '1', storedetaildate = '2026-09-28 15:46:20' WHERE storedetailid = '61';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('61', '1', '6', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '60', '54', '1', '2026-09-28 15:46:20','0','0'); -- id=2204
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '157', '1', '59', '15.00', '136', '2040', '0', '', '1', '2026-09-28 15:46:20', '59', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','2040','0','','0','0.00','0','0','0','0'); -- id=1096
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 = 1096;
 INSERT INTO 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-09-28', 2040, 1945.5, 1945.5
                    , 1945.5, 1945.5, 1945.5, 1945.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 1945.5, 1945.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1945.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1945.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1945.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1945.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1945.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1945.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1945.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1945.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2040, 1945.5, 1945.5
                    , 1945.5, 1945.5, 1945.5, 1945.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1945.5, 1945.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+1945.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1945.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1945.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1945.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1945.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1945.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1945.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1945.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 = '162', userid = '1', storedetaildate = '2026-09-28 15:46:20' WHERE storedetailid = '59';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('59', '1', '15', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '177', '162', '1', '2026-09-28 15:46:20','0','0'); -- id=2205
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00060', '157', '1', '60', '8.00', '136', '1088', '0', '', '1', '2026-09-28 15:46:20', '60', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','136','1088','0','','0','0.00','0','0','0','0'); -- id=1097
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 = 1097;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (60, '2026-09-28', 1088, 1037.6, 1037.6
                    , 1037.6, 1037.6, 1037.6, 1037.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1037.6, 1037.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1088, sellCostBuyPrice =sellCostBuyPrice+1037.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1037.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1037.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1037.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1037.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1037.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1037.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1037.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+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-09-28', 1088, 1037.6, 1037.6
                    , 1037.6, 1037.6, 1037.6, 1037.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1037.6, 1037.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1088, sellCostBuyPrice =sellCostBuyPrice+1037.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1037.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1037.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1037.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1037.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1037.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1037.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1037.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 = '43', userid = '1', storedetaildate = '2026-09-28 15:46:21' WHERE storedetailid = '60';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('60', '1', '8', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '51', '43', '1', '2026-09-28 15:46:21','0','0'); -- id=2206
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '157', '1', '9', '10.00', '319', '3190', '0', '', '1', '2026-09-28 15:46:21', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','71-10,','1','1','0','0','319','3190','0','','0','0.00','0','0','0','0'); -- id=1098
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 = 1098;
 INSERT INTO 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-09-28', 3190, 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+3190, 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-09-28', 3190, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3190, 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 = '56', userid = '1', storedetaildate = '2026-09-28 15:46:21' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '10', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '66', '56', '1', '2026-09-28 15:46:21','0','0'); -- id=2207
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','00283', '157', '22', '283', '5.00', '335', '1675', '0', '', '1', '2026-09-28 15:46:21', '283', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','335','1675','0','','0','0.00','0','0','0','0'); -- id=1099
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 1099;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (283, '2026-09-28', 1675, 1375, 1375
                    , 1375, 1375, 1375, 1375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1375, 1375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1675, sellCostBuyPrice =sellCostBuyPrice+1375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1675, 1375, 1375
                    , 1375, 1375, 1375, 1375
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1375, 1375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1675, sellCostBuyPrice =sellCostBuyPrice+1375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1375, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1375
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1375
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-28 15:46:21' WHERE storedetailid = '283';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('283', '1', '5', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '3', '1', '2026-09-28 15:46:21','0','0'); -- id=2208
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('137','00427', '157', '8', '427', '5.00', '225', '1125', '0', '', '1', '2026-09-28 15:46:21', '427', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','225','1125','0','','0','0.00','0','0','0','0'); -- id=1100
UPDATE sellbilldetail SET  lastbuyprice = 137.00 , meanbuyprice = 137.00, lastbuyprice_withDiscount = 137.00, meanbuyprice_withDiscount = 137.00
        , lastbuyprice_withTax = 137, meanbuyprice_withTax = 137, lastbuyprice_withDiscountAndTax = 137
                where sellbilldetailid = 1100;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (427, '2026-09-28', 1125, 685, 685
                    , 685, 685, 685, 685
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 685, 685, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1125, sellCostBuyPrice =sellCostBuyPrice+685
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+685, sellCostMeanBuyPrice = sellCostMeanBuyPrice+685
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+685, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+685
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+685
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+685
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+685
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1125, 685, 685
                    , 685, 685, 685, 685
                    , 0, 0, 0, 0
                    , 0, 0, 0, 685, 685, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1125, sellCostBuyPrice =sellCostBuyPrice+685
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+685, sellCostMeanBuyPrice = sellCostMeanBuyPrice+685
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+685, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+685
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+685
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+685
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+685
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-28 15:46:22' WHERE storedetailid = '427';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('427', '1', '5', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '50', '45', '1', '2026-09-28 15:46:22','0','0'); -- id=2209
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('255','00035', '157', '8', '35', '5', '295', '1475', '0', '', '1', '2026-09-28 15:46:22', '35', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','1475','0','','0','0.00','0','0','0','0'); -- id=1101
UPDATE sellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
        , lastbuyprice_withTax = 255, meanbuyprice_withTax = 255, lastbuyprice_withDiscountAndTax = 255
                where sellbilldetailid = 1101;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (35, '2026-09-28', 1475, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1475, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1475, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1475, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-09-28 15:46:22' WHERE storedetailid = '35';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('35', '1', '5', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '33', '28', '1', '2026-09-28 15:46:22','0','0'); -- id=2210
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('352','00036', '157', '8', '36', '5', '395', '1975', '0', '', '1', '2026-09-28 15:46:22', '36', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','395','1975','0','','0','0.00','0','0','0','0'); -- id=1102
UPDATE sellbilldetail SET  lastbuyprice = 352.00 , meanbuyprice = 352.00, lastbuyprice_withDiscount = 352.00, meanbuyprice_withDiscount = 352.00
        , lastbuyprice_withTax = 352, meanbuyprice_withTax = 352, lastbuyprice_withDiscountAndTax = 352
                where sellbilldetailid = 1102;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (36, '2026-09-28', 1975, 1760, 1760
                    , 1760, 1760, 1760, 1760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1760, 1760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1975, 1760, 1760
                    , 1760, 1760, 1760, 1760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1760, 1760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1975, sellCostBuyPrice =sellCostBuyPrice+1760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2026-09-28 15:46:22' WHERE storedetailid = '36';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('36', '1', '5', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '16', '11', '1', '2026-09-28 15:46:22','0','0'); -- id=2211
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('255','00032', '157', '8', '32', '5', '295', '1475', '0', '', '1', '2026-09-28 15:46:23', '32', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','1475','0','','0','0.00','0','0','0','0'); -- id=1103
UPDATE sellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
        , lastbuyprice_withTax = 255, meanbuyprice_withTax = 255, lastbuyprice_withDiscountAndTax = 255
                where sellbilldetailid = 1103;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (32, '2026-09-28', 1475, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1475, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1475, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1475, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2026-09-28 15:46:23' WHERE storedetailid = '32';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('32', '1', '5', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '36', '31', '1', '2026-09-28 15:46:23','0','0'); -- id=2212
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('200','00029', '157', '8', '29', '12', '245', '2940', '0', '', '1', '2026-09-28 15:46:23', '29', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','245','2940','0','','0','0.00','0','0','0','0'); -- id=1104
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 200.00, meanbuyprice_withDiscount = 200.00
        , lastbuyprice_withTax = 200, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 200
                where sellbilldetailid = 1104;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (29, '2026-09-28', 2940, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, 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+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 2940, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, 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-09-28 15:46:23' WHERE storedetailid = '29';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('29', '1', '12', '1', '157', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '12', '0', '1', '2026-09-28 15:46:23','0','0'); -- id=2213
UPDATE dailyentry SET totalcreditor = '53452.10', totaldebtor = '53452.10', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 10:08:20', entryComment = 'اضافة فاتورة مبيعات رقم 150', fromFlag = '1',related='0',isopeningentry='0',operationId='150',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=150' WHERE id = '1025';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '53452.10', '53452.10', '2026-09-28', '1', '0', '1025', '2026-09-28 15:46:23','تم عكس القيد رقم 1025 ','1','0','0','0','0',''); -- id=1055
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1055', '471', '53452.10', '','0'); -- id=1055
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-27 19:10:39' WHERE id = '471';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1055', '143', '53452.10', '','0'); -- id=1055
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '525318.72', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '49537.60', totaldebtor = '49537.60', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 10:08:20', entryComment = 'اضافة فاتورة مبيعات رقم 150 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='150',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=150' WHERE id = '1026';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '49537.60', '49537.60', '2026-09-28', '1', '0', '1026', '2026-09-28 15:46:24','تم عكس القيد رقم 1026 ','1','0','0','0','0',''); -- id=1056
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1056', '402', '49537.60', '','0'); -- id=1056
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '485682.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 ('1056', '382', '49537.60', '','0'); -- id=1056
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2549620.62', 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 ( '61317.1', '61317.1', '2026-09-28', '1', '0', '0', '2026-09-28 15:46:24','اضافة فاتورة مبيعات رقم 157','1','0',null,'0','157','sellbillController.php?do=showDetail&sellbillid=157'); -- id=1057
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1057', '471', '61317.1', '','0'); -- id=1057
UPDATE accountstree SET name = 'محمد عباس الطوخي', customName = 'محمد عباس الطوخي', customNameEn = 'محمد عباس الطوخي', nameEn = 'محمد عباس الطوخي', parent = '58', accountNature = '0', theValue = '61317.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 19:10:39' WHERE id = '471';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1057', '143', '61317.1', '','0'); -- id=1057
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '586635.82', 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 ( '56247.6', '56247.6', '2026-09-28', '1', '0', '0', '2026-09-28 15:46:24','اضافة فاتورة مبيعات رقم 157 - صرف البضاعة من المخزن','1','0',null,'0','157','sellbillController.php?do=showDetail&sellbillid=157'); -- id=1058
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1058', '402', '56247.6', '','0'); -- id=1058
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '541929.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 ('1058', '382', '56247.6', '','0'); -- id=1058
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2493373.02', 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='1057,0,1058' where sellbillid=157;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 61317.1, 56247.6, 56247.6
                    , 56233.33, 56247.6, 56233.33, 56247.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,56247.6, 56233.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+61317.1, sellCostBuyPrice =sellCostBuyPrice+56247.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+56247.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+56233.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+56247.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+56233.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+56247.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+56247.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+56233.33
                        , returnSellVal = returnSellVal+0, 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 (39, '2026-09-28', 61317.1, 56247.6, 56247.6
                    , 56233.33, 56247.6, 56233.33, 56247.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,56247.6, 56233.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+61317.1, sellCostBuyPrice =sellCostBuyPrice+56247.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+56247.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+56233.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+56247.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+56233.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+56247.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+56247.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+56233.33
                        , returnSellVal = returnSellVal+0, 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, 61317.1, 56247.6, 56247.6
                    , 56233.33, 56247.6, 56233.33, 56247.6, 56247.6, 56233.33)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+61317.1, netSellCostBuyPrice = netSellCostBuyPrice+56247.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+56247.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+56233.33
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+56247.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+56233.33
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+56247.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+56247.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+56233.33;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 150 and newid=157 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:16:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 15:46:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 15:46:26', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=157'); -- id=2740
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:47:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 16:17:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 16:17:25', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2741
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:47:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 16:17:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 16:17:38', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2742
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:47:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 16:17:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 16:17:42', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=157'); -- id=2743
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 12:47:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 16:17:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-28 16:17:59', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2744
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:04:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 16:34:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 16:34:05', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2745
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:04:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 16:34:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 16:34:48', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2746

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aba7adeb2f42
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 16:34:49', '06aba7adeb2f42', '1', '0.00', '0', '0', '1', '1860.00', '1860', '1860', '0', '1', '2026-09-28 16:34:49', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '20' ,'0','','','','','-1','0','0','0','0','0','1860','0','','0','0','1860','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=158
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','اضافة فاتورة مبيعات','158', '0', '2026-09-28 16:34:49', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1860', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-28 16:34:49','0','0','',''); -- id=266
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 16;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00387', '158', '7', '387', '20', '93', '1860', '0', '', '1', '2026-09-28 16:34:49', '387', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','16-20,','1','1','0','0','93','1860','0','','0','0.00','0','0','0','0'); -- id=1105
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.58, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.58
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80.58, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1105;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (387, '2026-09-28', 1860, 1600, 1600
                    , 1611.6, 1600, 1611.6, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 1600, 1611.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1611.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1611.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1611.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+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1860, 1600, 1600
                    , 1611.6, 1600, 1611.6, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1600, 1611.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1611.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1611.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1611.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 = '17', userid = '1', storedetaildate = '2026-09-28 16:34:50' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '20', '1', '158', 'اضافة فاتورة مبيعات', 'sellbillController.php', '37', '17', '1', '2026-09-28 16:34:50','0','0'); -- id=2214
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-451183.53125',  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 ('-453043.53125','1860', '0', '1', 'اضافة فاتورة مبيعات', '158', '-451183.53125', '2026-09-28 16:34:50', '1',  'sellbillController.php','1','','0'); -- id=164
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1860', '1860', '2026-09-28', '1', '0', '0', '2026-09-28 16:34:50','اضافة فاتورة مبيعات رقم 158','1','0',null,'0','158','sellbillController.php?do=showDetail&sellbillid=158'); -- id=1059
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1059', '383', '1860', '','0'); -- id=1059
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-291101.99', 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 ('1059', '143', '1860', '','0'); -- id=1059
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '588495.82', 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 ( '1600', '1600', '2026-09-28', '1', '0', '0', '2026-09-28 16:34:50','اضافة فاتورة مبيعات رقم 158 - صرف البضاعة من المخزن','1','0',null,'0','158','sellbillController.php?do=showDetail&sellbillid=158'); -- id=1060
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1060', '402', '1600', '','0'); -- id=1060
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '543529.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 ('1060', '382', '1600', '','0'); -- id=1060
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2491773.02', 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='1059,0,1060' where sellbillid=158;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 1860, 1600, 1600
                    , 1611.6, 1600, 1611.6, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1600, 1611.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1611.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1611.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1611.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1860, 1600, 1600
                    , 1611.6, 1600, 1611.6, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1600, 1611.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1611.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1611.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1611.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1860, 1600, 1600
                    , 1611.6, 1600, 1611.6, 1600, 1600, 1611.6)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1860, netSellCostBuyPrice = netSellCostBuyPrice+1600
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1600
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1611.6
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1600
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1611.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1600
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1600
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1611.6;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aba7adeb2f42 and sellbillId = 158 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:04:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 16:34:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 16:34:51', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2747
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:46:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:16:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 17:16:22', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2748
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:46:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:16:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 17:16:52', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=2749
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('متر سلك 16 ملي سعودي','','10','157','175','175','175','2026-09-28','0','1','0','','0','0','0','0','0','157','157','157','157','157','0','11.46','11.46','11.46','.','0','0','0','157','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','157','157','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','157','0','0','0','0','0','0','','','0','0','0','0'); -- id=531
UPDATE product SET productName = 'متر سلك 16 ملي سعودي', productDescription = '', productCatId = '10', productBuyPrice = '157', productSellAllPrice = '175', productSellUnitPrice = '175', productSellHalfPrice = '175', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00531',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '157',lastbuyprice_withDiscount = '157',meanbuyprice = '157',meanbuyprice_withDiscount = '157' , productbuypricereal = '157' , buypricereal_precentage = '0' , buytotal_precentage = '11.46' , buyhalf_precentage = '11.46' , buypart_precentage = '11.46',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='157',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='157',meanbuyprice_withTax='157',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='157',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '531';
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', '531', '1.00', '2026-09-28', '1', '0','0053101','175','175','175','157','','0','0','0','0','0','0','0','0','0','0'); -- id=531
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('531', '1', '44', '1', '2026-09-28'); -- id=531
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '0', '531', 'إضافة منتج', 'productController.php', '0', '44', '1', '2026-09-28','0','0'); -- id=2215
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (531, 1,'2026-09-28 17:16:53',1)
                ON DUPLICATE KEY UPDATE productid = 531, edited = 1, sysdate = '2026-09-28 17:16:53', userid = 1; -- id=659
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6908', '6908', '2026-09-28', '1', '0', '0', '2026-09-28 17:16:53','إضافة منتج متر سلك 16 ملي سعودي الكمية 44','1','0','0','0','531','productController.php?do=edit&id=531'); -- id=1061
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1061', '382', '6908', '','0'); -- id=1061
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2498681.02', 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 ('1061', '121', '6908', '','0'); -- id=1061
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1537675.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'متر سلك 16 ملي سعودي', productDescription = '', productCatId = '10', productBuyPrice = '157.00', productSellAllPrice = '175.00', productSellUnitPrice = '175.00', productSellHalfPrice = '175.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00531',type ='0', expireDate = '0' , dailyentryId = '1061',isService = '0',isOptic = '0',lastbuyprice = '157',lastbuyprice_withDiscount = '157',meanbuyprice = '157',meanbuyprice_withDiscount = '157' , productbuypricereal = '157' , buypricereal_precentage = '0' , buytotal_precentage = '11.46' , buyhalf_precentage = '11.46' , buypart_precentage = '11.46',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='157',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='157',meanbuyprice_withTax='157',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='157',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '531';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:46:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:16:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 17:16:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2750
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:46:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:16:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:16:57', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2751
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:47:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:17:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:17:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2752
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:48:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:18:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:18:19', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=155'); -- id=2753
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:48:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:18:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:18:50', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2754
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 155;
UPDATE sellbill SET  sellbillsysdate = '2026-09-28 17:18:51', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '155';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 110;
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1060;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '82.55', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '74.55', '82.55', '1', '2026-09-26 16:55:00','0','0'); -- id=2216
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 = 1061;
 INSERT INTO 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-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0,16,0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-16
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '707', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '691', '707', '1', '2026-09-26 16:55:00','0','0'); -- id=2217
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 = 1062;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '872', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '857', '872', '1', '2026-09-26 16:55:00','0','0'); -- id=2218
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1063;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '123', '124', '1', '2026-09-26 16:55:00','0','0'); -- id=2219
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1064;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '221', '223', '1', '2026-09-26 16:55:00','0','0'); -- id=2220
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1065;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=2221
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1066;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '27', '30', '1', '2026-09-26 16:55:00','0','0'); -- id=2222
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1067;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-28 17:18:51' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '155', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=2223
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-6268.9', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','4835.10','11104.00','1','تعديل فاتورة مبيعات','155', '-6268.9', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '11104', '0', null, '0', null, null,'', '0','1','1','11104','1','2026-09-26 16:55:00','0','0','',''); -- id=267
UPDATE client SET  inUse = 0 where clientid = 5;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11104, sellCostBuyPrice =sellCostBuyPrice-9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9525.12
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9597.12, 9525.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-11104, sellCostBuyPrice =sellCostBuyPrice-9597.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9597.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9525.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9597.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9525.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9597.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9597.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9525.12
                        , returnSellVal = returnSellVal-0, 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, 11104, 9597.12, 9597.12
                    , 9525.12, 9597.12, 9525.12, 9597.12, 9597.12, 9525.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-11104, netSellCostBuyPrice = netSellCostBuyPrice-9597.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-9597.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-9525.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-9597.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-9525.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-9597.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-9597.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-9525.12;

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


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

COMMIT;
BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:55:00', '06ab7da708e886', '5', '-6268.90', '12535.1', '0', '1', '18804', '18804', '0', '18804', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '91', '155', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=159
UPDATE client SET  clientdebt = '12535.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','-6268.90','18804','0','اضافة فاتورة مبيعات (معدله)','159', '12535.1', '2026-09-28 17:18:52', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '18804', '0', null, '0', null, null,'', '0','1','1','11104','1','2026-09-26 16:55:00','0','0','',''); -- id=268
UPDATE client SET  inUse = 0 where clientid = 5;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 110;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1040','00208', '159', '10', '208', '8.00', '1210', '9680', '0', '', '1', '2026-09-28 17:18:52', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','110-8,','1','1','0','0','1210','9680','0','','0','0.00','0','0','0','0'); -- id=1106
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1106;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74.55', userid = '1', storedetaildate = '2026-09-28 17:18:53' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '82.55', '74.55', '1', '2026-09-28 17:18:53','0','0'); -- id=2224
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '159', '6', '315', '16.00', '8', '128', '0', '', '1', '2026-09-28 17:18:53', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','128','0','','0','0.00','0','0','0','0'); -- id=1107
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 = 1107;
 INSERT INTO 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-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '691', userid = '1', storedetaildate = '2026-09-28 17:18:53' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '707', '691', '1', '2026-09-28 17:18:53','0','0'); -- id=2225
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '159', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-09-28 17:18:53', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','720','0','','0','0.00','0','0','0','0'); -- id=1108
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 = 1108;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '857', userid = '1', storedetaildate = '2026-09-28 17:18:53' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '872', '857', '1', '2026-09-28 17:18:53','0','0'); -- id=2226
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157.92','00186', '159', '20', '186', '1.00', '165', '165', '0', '', '1', '2026-09-28 17:18:53', '186', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','165','165','0','','0','0.00','0','0','0','0'); -- id=1109
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1109;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '1', storedetaildate = '2026-09-28 17:18:54' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '123', '1', '2026-09-28 17:18:54','0','0'); -- id=2227
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('139.2','00185', '159', '20', '185', '2.00', '150', '300', '0', '', '1', '2026-09-28 17:18:54', '185', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=1110
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1110;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '221', userid = '1', storedetaildate = '2026-09-28 17:18:54' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '223', '221', '1', '2026-09-28 17:18:54','0','0'); -- id=2228
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8','00530', '159', '6', '530', '1.00', '10', '10', '0', '', '1', '2026-09-28 17:18:54', '530', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','10','0','','0','0.00','0','0','0','0'); -- id=1111
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1111;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 17:18:54' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 17:18:54','0','0'); -- id=2229
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('23','00529', '159', '6', '529', '3.00', '26', '78', '0', '', '1', '2026-09-28 17:18:54', '529', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','78','0','','0','0.00','0','0','0','0'); -- id=1112
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1112;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-09-28 17:18:55' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '27', '1', '2026-09-28 17:18:55','0','0'); -- id=2230
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '159', '6', '527', '1.00', '23', '23', '0', '', '1', '2026-09-28 17:18:55', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=1113
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1113;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 17:18:55' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 17:18:55','0','0'); -- id=2231
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157','00531', '159', '10', '531', '44', '175', '7700', '0', '', '1', '2026-09-28 17:18:55', '531', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','175','7700','0','','0','0.00','0','0','0','0'); -- id=1114
UPDATE sellbilldetail SET  lastbuyprice = 157.00 , meanbuyprice = 157.00, lastbuyprice_withDiscount = 157.00, meanbuyprice_withDiscount = 157.00
        , lastbuyprice_withTax = 157, meanbuyprice_withTax = 157, lastbuyprice_withDiscountAndTax = 157
                where sellbilldetailid = 1114;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (531, '2026-09-28', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7700, sellCostBuyPrice =sellCostBuyPrice+6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6908
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+44
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7700, sellCostBuyPrice =sellCostBuyPrice+6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6908
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-28 17:18:55' WHERE storedetailid = '531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '1', '159', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '0', '1', '2026-09-28 17:18:55','0','0'); -- id=2232
UPDATE dailyentry SET totalcreditor = '11104.00', totaldebtor = '11104.00', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 14:00:40', entryComment = 'اضافة فاتورة مبيعات رقم 155', fromFlag = '1',related='0',isopeningentry='0',operationId='155',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=155' WHERE id = '1048';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11104.00', '11104.00', '2026-09-28', '1', '0', '1048', '2026-09-28 17:18:56','تم عكس القيد رقم 1048 ','1','0','0','0','0',''); -- id=1062
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1062', '430', '11104.00', '','0'); -- id=1062
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '-6268.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1062', '143', '11104.00', '','0'); -- id=1062
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '577391.82', 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 = '9597.12', totaldebtor = '9597.12', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 14:00:40', entryComment = 'اضافة فاتورة مبيعات رقم 155 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='155',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=155' WHERE id = '1049';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9597.12', '9597.12', '2026-09-28', '1', '0', '1049', '2026-09-28 17:18:56','تم عكس القيد رقم 1049 ','1','0','0','0','0',''); -- id=1063
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1063', '402', '9597.12', '','0'); -- id=1063
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '533932.53', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1063', '382', '9597.12', '','0'); -- id=1063
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2508278.14', 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 ( '18804', '18804', '2026-09-28', '1', '0', '0', '2026-09-28 17:18:57','اضافة فاتورة مبيعات رقم 159','1','0',null,'0','159','sellbillController.php?do=showDetail&sellbillid=159'); -- id=1064
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1064', '430', '18804', '','0'); -- id=1064
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '12535.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1064', '143', '18804', '','0'); -- id=1064
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '596195.82', 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 ( '16505.12', '16505.12', '2026-09-28', '1', '0', '0', '2026-09-28 17:18:57','اضافة فاتورة مبيعات رقم 159 - صرف البضاعة من المخزن','1','0',null,'0','159','sellbillController.php?do=showDetail&sellbillid=159'); -- id=1065
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1065', '402', '16505.12', '','0'); -- id=1065
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '550437.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 ('1065', '382', '16505.12', '','0'); -- id=1065
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2491773.02', 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='1064,0,1065' where sellbillid=159;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 18804, 16505.12, 16505.12
                    , 16433.12, 16505.12, 16433.12, 16505.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,16505.12, 16433.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18804, sellCostBuyPrice =sellCostBuyPrice+16505.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16505.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16433.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16505.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16433.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16505.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16505.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16433.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 18804, 16505.12, 16505.12
                    , 16433.12, 16505.12, 16433.12, 16505.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,16505.12, 16433.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18804, sellCostBuyPrice =sellCostBuyPrice+16505.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16505.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16433.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16505.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16433.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16505.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16505.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16433.12
                        , returnSellVal = returnSellVal+0, 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, 18804, 16505.12, 16505.12
                    , 16433.12, 16505.12, 16433.12, 16505.12, 16505.12, 16433.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+18804, netSellCostBuyPrice = netSellCostBuyPrice+16505.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+16505.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+16433.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+16505.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+16433.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+16505.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+16505.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+16433.12;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 155 and newid=159 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 13:48:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:18:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:18:58', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=159'); -- id=2755
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:10:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:40:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:40:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2756
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:10:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:40:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:40:19', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2757
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:10:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:40:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:40:25', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=156'); -- id=2758
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:11:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:41:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:41:49', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2759
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 156;
UPDATE sellbill SET  sellbillsysdate = '2026-09-28 17:41:50', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '156';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 48;
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 1068;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, sellCostBuyPrice =sellCostBuyPrice-79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-90, sellCostBuyPrice =sellCostBuyPrice-79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '280', userid = '1', storedetaildate = '2026-09-28 17:41:50' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '0', '156', 'تعديل فاتورة مبيعات', 'sellbillController.php', '278', '280', '1', '2026-09-26 12:06:36','0','0'); -- id=2233
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 1069;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-65, sellCostBuyPrice =sellCostBuyPrice-59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-59, sellCostMeanBuyPrice = sellCostMeanBuyPrice-59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-59
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-65, sellCostBuyPrice =sellCostBuyPrice-59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-59, sellCostMeanBuyPrice = sellCostMeanBuyPrice-59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-59
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '445', userid = '1', storedetaildate = '2026-09-28 17:41:50' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '10', '0', '156', 'تعديل فاتورة مبيعات', 'sellbillController.php', '435', '445', '1', '2026-09-26 12:06:36','0','0'); -- id=2234
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1070;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-48, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-48, sellCostBuyPrice =sellCostBuyPrice-44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-44.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '125', userid = '1', storedetaildate = '2026-09-28 17:41:50' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '4', '0', '156', 'تعديل فاتورة مبيعات', 'sellbillController.php', '121', '125', '1', '2026-09-26 12:06:36','0','0'); -- id=2235
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 46;
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 418.03, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 418.03
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 418.03, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 1071;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-475, sellCostBuyPrice =sellCostBuyPrice-435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-435, sellCostMeanBuyPrice = sellCostMeanBuyPrice-418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-418.03
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-475, sellCostBuyPrice =sellCostBuyPrice-435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-435, sellCostMeanBuyPrice = sellCostMeanBuyPrice-418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-418.03
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-09-28 17:41:50' WHERE storedetailid = '73';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '1', '1', '0', '156', 'تعديل فاتورة مبيعات', 'sellbillController.php', '28', '29', '1', '2026-09-26 12:06:36','0','0'); -- id=2236
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 45;
UPDATE sellbilldetail SET  lastbuyprice = 348.00 , meanbuyprice = 332.81, lastbuyprice_withDiscount = 348.00, meanbuyprice_withDiscount = 332.81
        , lastbuyprice_withTax = 348, meanbuyprice_withTax = 332.81, lastbuyprice_withDiscountAndTax = 348
                where sellbilldetailid = 1072;
 INSERT INTO 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-09-28', 760, 696, 696
                    , 665.62, 696, 665.62, 680
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 696, 665.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-760, sellCostBuyPrice =sellCostBuyPrice-696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-696, sellCostMeanBuyPrice = sellCostMeanBuyPrice-665.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-665.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-665.62
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 760, 696, 696
                    , 665.62, 696, 665.62, 680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 696, 665.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-760, sellCostBuyPrice =sellCostBuyPrice-696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-696, sellCostMeanBuyPrice = sellCostMeanBuyPrice-665.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-665.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-665.62
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '95', userid = '1', storedetaildate = '2026-09-28 17:41:50' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '2', '0', '156', 'تعديل فاتورة مبيعات', 'sellbillController.php', '93', '95', '1', '2026-09-26 12:06:36','0','0'); -- id=2237
CALL clientInUse(18,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '520', userid = '1' WHERE clientid = '18';
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 ('18','1958.00','1438.00','1','تعديل فاتورة مبيعات','156', '520', '2026-09-26 12:06:36', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '1438', '0', null, '0', null, null,'', '0','1','1','1438','1','2026-09-26 12:06:36','0','0','',''); -- id=269
UPDATE client SET  inUse = 0 where clientid = 18;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 1438, 1313.6, 1313.6
                    , 1268.85, 1313.6, 1268.85, 1286.06
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1313.6, 1268.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1438, sellCostBuyPrice =sellCostBuyPrice-1313.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1313.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1268.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1313.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1268.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1286.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1313.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1268.85
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-28', 1438, 1313.6, 1313.6
                    , 1268.85, 1313.6, 1268.85, 1286.06
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1313.6, 1268.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1438, sellCostBuyPrice =sellCostBuyPrice-1313.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1313.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1268.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1313.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1268.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1286.06
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1313.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1268.85
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1438, 1313.6, 1313.6
                    , 1268.85, 1313.6, 1268.85, 1286.06, 1313.6, 1268.85)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-1438, netSellCostBuyPrice = netSellCostBuyPrice-1313.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-1313.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-1268.85
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-1313.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-1268.85
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-1286.06
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-1313.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-1268.85;

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


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

COMMIT;
BEGIN;
CALL clientInUse(18,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 12:06:36', '06ab798ee5ed8b', '18', '520.00', '2625', '0', '1', '2105', '2105', '0', '2105', '1', '2026-09-26 12:06:36', '', '1', '0', 'محمد السعيد صالح ', '1', '1', '3', '0', 'محمد السعيد صالح ', '29', '156', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=160
UPDATE client SET  clientdebt = '2625', userid = '1' WHERE clientid = '18';
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 ('18','520.00','2105','0','اضافة فاتورة مبيعات (معدله)','160', '2625', '2026-09-28 17:41:51', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2105', '0', null, '0', null, null,'', '0','1','1','1438','1','2026-09-26 12:06:36','0','0','',''); -- id=270
UPDATE client SET  inUse = 0 where clientid = 18;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '160', '12', '83', '2.00', '45', '90', '0', '', '1', '2026-09-28 17:41:52', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-2,','1','1','0','0','45','90','0','','0','0.00','0','0','0','0'); -- id=1115
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 = 1115;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 90, 79.2, 79.2
                    , 81.8, 79.2, 81.8, 79.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 79.2, 81.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+79.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+79.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+79.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+79.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+79.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '278', userid = '1', storedetaildate = '2026-09-28 17:41:52' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '2', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '280', '278', '1', '2026-09-28 17:41:52','0','0'); -- id=2238
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '160', '12', '86', '10.00', '6.5', '65', '0', '', '1', '2026-09-28 17:41:52', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.5','65','0','','0','0.00','0','0','0','0'); -- id=1116
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 1116;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 65, 59, 59
                    , 59, 59, 59, 59
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59, 59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+65, sellCostBuyPrice =sellCostBuyPrice+59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '435', userid = '1', storedetaildate = '2026-09-28 17:41:52' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '10', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '445', '435', '1', '2026-09-28 17:41:52','0','0'); -- id=2239
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.1','00088', '160', '12', '88', '4.00', '12', '48', '0', '', '1', '2026-09-28 17:41:52', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','48','0','','0','0.00','0','0','0','0'); -- id=1117
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1117;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 48, 44.4, 44.4
                    , 44.4, 44.4, 44.4, 44.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44.4, 44.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48, sellCostBuyPrice =sellCostBuyPrice+44.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+44.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+44.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+44.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+44.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+44.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+44.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+44.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '121', userid = '1', storedetaildate = '2026-09-28 17:41:52' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '4', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '125', '121', '1', '2026-09-28 17:41:52','0','0'); -- id=2240
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 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 ('415','00073', '160', '12', '73', '1.00', '475', '475', '0', '', '1', '2026-09-28 17:41:53', '73', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','46-1,','1','1','0','0','475','475','0','','0','0.00','0','0','0','0'); -- id=1118
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 418.03, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 418.03
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 418.03, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 1118;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+435, sellCostMeanBuyPrice = sellCostMeanBuyPrice+418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+418.03
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 475, 435, 435
                    , 418.03, 435, 418.03, 423.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 435, 418.03, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+435
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+435, sellCostMeanBuyPrice = sellCostMeanBuyPrice+418.03
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+435, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+418.03
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+423.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+435
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+418.03
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-09-28 17:41:53' WHERE storedetailid = '73';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '1', '1', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '29', '28', '1', '2026-09-28 17:41:53','0','0'); -- id=2241
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 45;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('332','00070', '160', '12', '70', '2.00', '380', '760', '0', '', '1', '2026-09-28 17:41:53', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','45-2,','1','1','0','0','380','760','0','','0','0.00','0','0','0','0'); -- id=1119
UPDATE sellbilldetail SET  lastbuyprice = 348.00 , meanbuyprice = 332.81, lastbuyprice_withDiscount = 348.00, meanbuyprice_withDiscount = 332.81
        , lastbuyprice_withTax = 348, meanbuyprice_withTax = 332.81, lastbuyprice_withDiscountAndTax = 348
                where sellbilldetailid = 1119;
 INSERT INTO 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-09-28', 760, 696, 696
                    , 665.62, 696, 665.62, 680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 696, 665.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+665.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+665.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+665.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 760, 696, 696
                    , 665.62, 696, 665.62, 680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 696, 665.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+665.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+665.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+665.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '93', userid = '1', storedetaildate = '2026-09-28 17:41:53' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '2', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '95', '93', '1', '2026-09-28 17:41:53','0','0'); -- id=2242
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('65.66','00183', '160', '20', '183', '3', '75', '225', '0', '', '1', '2026-09-28 17:41:53', '183', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','75','225','0','','0','0.00','0','0','0','0'); -- id=1120
UPDATE sellbilldetail SET  lastbuyprice = 65.66 , meanbuyprice = 65.66, lastbuyprice_withDiscount = 65.66, meanbuyprice_withDiscount = 65.66
        , lastbuyprice_withTax = 65.66, meanbuyprice_withTax = 65.66, lastbuyprice_withDiscountAndTax = 65.66
                where sellbilldetailid = 1120;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (183, '2026-09-28', 225, 196.98, 196.98
                    , 196.98, 196.98, 196.98, 196.98
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 196.98, 196.98, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, sellCostBuyPrice =sellCostBuyPrice+196.98
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+196.98, sellCostMeanBuyPrice = sellCostMeanBuyPrice+196.98
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+196.98, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+196.98
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+196.98
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+196.98
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+196.98
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 225, 196.98, 196.98
                    , 196.98, 196.98, 196.98, 196.98
                    , 0, 0, 0, 0
                    , 0, 0, 0, 196.98, 196.98, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, sellCostBuyPrice =sellCostBuyPrice+196.98
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+196.98, sellCostMeanBuyPrice = sellCostMeanBuyPrice+196.98
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+196.98, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+196.98
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+196.98
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+196.98
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+196.98
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '529', userid = '1', storedetaildate = '2026-09-28 17:41:54' WHERE storedetailid = '183';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('183', '1', '3', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '532', '529', '1', '2026-09-28 17:41:54','0','0'); -- id=2243
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('9.8','00192', '160', '20', '192', '3', '10', '30', '0', '', '1', '2026-09-28 17:41:54', '192', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','30','0','','0','0.00','0','0','0','0'); -- id=1121
UPDATE sellbilldetail SET  lastbuyprice = 9.80 , meanbuyprice = 9.80, lastbuyprice_withDiscount = 9.80, meanbuyprice_withDiscount = 9.80
        , lastbuyprice_withTax = 9.8, meanbuyprice_withTax = 9.8, lastbuyprice_withDiscountAndTax = 9.8
                where sellbilldetailid = 1121;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (192, '2026-09-28', 30, 29.4, 29.4
                    , 29.4, 29.4, 29.4, 29.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 29.4, 29.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+29.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+29.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-09-28', 30, 29.4, 29.4
                    , 29.4, 29.4, 29.4, 29.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 29.4, 29.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+29.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+29.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 = '37', userid = '1', storedetaildate = '2026-09-28 17:41:54' WHERE storedetailid = '192';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('192', '1', '3', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '40', '37', '1', '2026-09-28 17:41:54','0','0'); -- id=2244
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 23;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('101','00107', '160', '3', '107', '4', '103', '412', '0', '', '1', '2026-09-28 17:41:54', '107', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','23-4,','1','1','0','0','103','412','0','','0','0.00','0','0','0','0'); -- id=1122
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 = 1122;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (107, '2026-09-28', 412, 404, 404
                    , 404, 404, 404, 404
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 404, 404, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+412, sellCostBuyPrice =sellCostBuyPrice+404
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+404, sellCostMeanBuyPrice = sellCostMeanBuyPrice+404
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+404, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+404
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+404
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+404
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+404
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 412, 404, 404
                    , 404, 404, 404, 404
                    , 0, 0, 0, 0
                    , 0, 0, 0, 404, 404, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+412, sellCostBuyPrice =sellCostBuyPrice+404
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+404, sellCostMeanBuyPrice = sellCostMeanBuyPrice+404
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+404, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+404
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+404
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+404
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+404
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '75', userid = '1', storedetaildate = '2026-09-28 17:41:54' WHERE storedetailid = '107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('107', '1', '4', '1', '160', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '79', '75', '1', '2026-09-28 17:41:54','0','0'); -- id=2245
UPDATE dailyentry SET totalcreditor = '1438.00', totaldebtor = '1438.00', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 14:11:31', entryComment = 'اضافة فاتورة مبيعات رقم 156', fromFlag = '1',related='0',isopeningentry='0',operationId='156',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=156' WHERE id = '1052';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1438.00', '1438.00', '2026-09-28', '1', '0', '1052', '2026-09-28 17:41:54','تم عكس القيد رقم 1052 ','1','0','0','0','0',''); -- id=1066
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1066', '447', '1438.00', '','0'); -- id=1066
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '520', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:42:27' WHERE id = '447';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1066', '143', '1438.00', '','0'); -- id=1066
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '594757.82', 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 = '1313.60', totaldebtor = '1313.60', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 14:11:31', entryComment = 'اضافة فاتورة مبيعات رقم 156 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='156',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=156' WHERE id = '1053';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1313.60', '1313.60', '2026-09-28', '1', '0', '1053', '2026-09-28 17:41:55','تم عكس القيد رقم 1053 ','1','0','0','0','0',''); -- id=1067
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1067', '402', '1313.60', '','0'); -- id=1067
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '549124.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 ('1067', '382', '1313.60', '','0'); -- id=1067
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2493086.62', 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 ( '2105', '2105', '2026-09-28', '1', '0', '0', '2026-09-28 17:41:55','اضافة فاتورة مبيعات رقم 160','1','0',null,'0','160','sellbillController.php?do=showDetail&sellbillid=160'); -- id=1068
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1068', '447', '2105', '','0'); -- id=1068
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '2625', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:42:27' WHERE id = '447';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1068', '143', '2105', '','0'); -- id=1068
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '596862.82', 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 ( '1943.98', '1943.98', '2026-09-28', '1', '0', '0', '2026-09-28 17:41:55','اضافة فاتورة مبيعات رقم 160 - صرف البضاعة من المخزن','1','0',null,'0','160','sellbillController.php?do=showDetail&sellbillid=160'); -- id=1069
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1069', '402', '1943.98', '','0'); -- id=1069
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '551068.03', 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 ('1069', '382', '1943.98', '','0'); -- id=1069
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2491142.64', 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='1068,0,1069' where sellbillid=160;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 2105, 1943.98, 1943.98
                    , 1899.23, 1943.98, 1899.23, 1916.44
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1943.98, 1899.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2105, sellCostBuyPrice =sellCostBuyPrice+1943.98
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1943.98, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1899.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1943.98, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1899.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1916.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1943.98
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1899.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;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-28', 2105, 1943.98, 1943.98
                    , 1899.23, 1943.98, 1899.23, 1916.44
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1943.98, 1899.23, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2105, sellCostBuyPrice =sellCostBuyPrice+1943.98
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1943.98, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1899.23
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1943.98, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1899.23
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1916.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1943.98
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1899.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;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2105, 1943.98, 1943.98
                    , 1899.23, 1943.98, 1899.23, 1916.44, 1943.98, 1899.23)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2105, netSellCostBuyPrice = netSellCostBuyPrice+1943.98
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1943.98
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1899.23
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1943.98
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1899.23
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1916.44
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1943.98
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1899.23;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 156 and newid=160 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:11:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:41:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:41:57', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2760
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:11:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 17:41:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 17:41:58', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=160'); -- id=2761
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:33:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:03:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:03:41', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2762
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:33:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:03:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 18:03:50', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2763
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:33:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:03:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 18:03:54', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2764
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:34:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:04:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:04:02', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2765
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:34:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:04:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:04:08', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2766
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:34:27";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:34:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:04:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-28 18:04:33', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=2767
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:34:34";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-28 18:04:34', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=2768
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:34:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:04:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:04:45', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2769
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:34:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:04:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:04:48', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2770
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:35:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:05:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:05:42', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2771
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:36:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:06:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:06:03', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2772
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:36:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:06:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:06:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2773
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:36:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:06:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:06:37', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2774
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:36:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:06:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 18:06:54', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2775
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:37:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:07:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 18:07:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2776
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:37:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 18:07:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-28 18:07:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=2777
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 14:37:53";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-28 18:07:58', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=2778
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 15:36:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 19:06:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 19:06:34', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2779
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 15:37:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 19:07:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 19:07:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2780
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 15:37:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 19:07:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 19:07:42', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2781
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:48:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:18:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:18:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2782
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:48:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:18:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:18:29', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2783
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:48:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:18:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:18:40', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=159'); -- id=2784
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:48:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:18:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:18:48', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2785
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:48:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:18:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:18:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2786
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:49:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:19:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:19:15', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=36'); -- id=2787
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:49:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:19:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:19:22', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2788
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:49:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:19:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:19:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2789
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:49:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:19:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:19:34', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=159'); -- id=2790
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:52:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:22:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:22:08', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2791
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 159;
UPDATE sellbill SET  sellbillsysdate = '2026-09-28 20:22:08', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '159';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 110;
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1106;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9680, sellCostBuyPrice =sellCostBuyPrice-8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8248
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '82.55', userid = '1', storedetaildate = '2026-09-28 20:22:08' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '74.55', '82.55', '1', '2026-09-26 16:55:00','0','0'); -- id=2246
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 = 1107;
 INSERT INTO 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-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0,16,0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-16
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-104, sellCostMeanBuyPrice = sellCostMeanBuyPrice-104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-104
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '707', userid = '1', storedetaildate = '2026-09-28 20:22:08' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '691', '707', '1', '2026-09-26 16:55:00','0','0'); -- id=2247
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 = 1108;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '872', userid = '1', storedetaildate = '2026-09-28 20:22:09' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '857', '872', '1', '2026-09-26 16:55:00','0','0'); -- id=2248
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1109;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-157.92
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '124', userid = '1', storedetaildate = '2026-09-28 20:22:09' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '123', '124', '1', '2026-09-26 16:55:00','0','0'); -- id=2249
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1110;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-300, sellCostBuyPrice =sellCostBuyPrice-278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-278.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '223', userid = '1', storedetaildate = '2026-09-28 20:22:09' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '221', '223', '1', '2026-09-26 16:55:00','0','0'); -- id=2250
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1111;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10, sellCostBuyPrice =sellCostBuyPrice-8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-28 20:22:09' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=2251
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1112;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-78, sellCostBuyPrice =sellCostBuyPrice-69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-69, sellCostMeanBuyPrice = sellCostMeanBuyPrice-69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-69
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-09-28 20:22:09' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '27', '30', '1', '2026-09-26 16:55:00','0','0'); -- id=2252
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1113;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-28 20:22:09' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-26 16:55:00','0','0'); -- id=2253
UPDATE sellbilldetail SET  lastbuyprice = 157.00 , meanbuyprice = 157.00, lastbuyprice_withDiscount = 157.00, meanbuyprice_withDiscount = 157.00
        , lastbuyprice_withTax = 157, meanbuyprice_withTax = 157, lastbuyprice_withDiscountAndTax = 157
                where sellbilldetailid = 1114;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (531, '2026-09-28', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0,44,0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7700, sellCostBuyPrice =sellCostBuyPrice-6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6908
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-44
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-7700, sellCostBuyPrice =sellCostBuyPrice-6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice-6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-6908
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-09-28 20:22:09' WHERE storedetailid = '531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '0', '159', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '44', '1', '2026-09-26 16:55:00','0','0'); -- id=2254
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-6268.9', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','12535.10','18804.00','1','تعديل فاتورة مبيعات','159', '-6268.9', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '18804', '0', null, '0', null, null,'', '0','1','1','18804','1','2026-09-26 16:55:00','0','0','',''); -- id=271
UPDATE client SET  inUse = 0 where clientid = 5;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 18804, 16505.12, 16505.12
                    , 16433.12, 16505.12, 16433.12, 16505.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,16505.12, 16433.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-18804, sellCostBuyPrice =sellCostBuyPrice-16505.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-16505.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-16433.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-16505.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-16433.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-16505.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-16505.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-16433.12
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 18804, 16505.12, 16505.12
                    , 16433.12, 16505.12, 16433.12, 16505.12
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16505.12, 16433.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-18804, sellCostBuyPrice =sellCostBuyPrice-16505.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-16505.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice-16433.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-16505.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-16433.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-16505.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-16505.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-16433.12
                        , returnSellVal = returnSellVal-0, 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, 18804, 16505.12, 16505.12
                    , 16433.12, 16505.12, 16433.12, 16505.12, 16505.12, 16433.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-18804, netSellCostBuyPrice = netSellCostBuyPrice-16505.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-16505.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-16433.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-16505.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-16433.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-16505.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-16505.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-16433.12;

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


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

COMMIT;
BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:55:00', '06ab7da708e886', '5', '-6268.90', '16623.1', '0', '1', '22892', '22892', '0', '22892', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '147', '159', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=161
UPDATE client SET  clientdebt = '16623.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','-6268.90','22892','0','اضافة فاتورة مبيعات (معدله)','161', '16623.1', '2026-09-28 20:22:10', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '22892', '0', null, '0', null, null,'', '0','1','1','18804','1','2026-09-26 16:55:00','0','0','',''); -- id=272
UPDATE client SET  inUse = 0 where clientid = 5;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 110;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1040','00208', '161', '10', '208', '8.00', '1210', '9680', '0', '', '1', '2026-09-28 20:22:10', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','110-8,','1','1','0','0','1210','9680','0','','0','0.00','0','0','0','0'); -- id=1123
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1031.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1031.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1031, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 1123;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 9680, 8320, 8320
                    , 8248, 8320, 8248, 8320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8320, 8248, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9680, sellCostBuyPrice =sellCostBuyPrice+8320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8248
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8248
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8248
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74.55', userid = '1', storedetaildate = '2026-09-28 20:22:10' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '8', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '82.55', '74.55', '1', '2026-09-28 20:22:10','0','0'); -- id=2255
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '161', '6', '315', '16.00', '8', '128', '0', '', '1', '2026-09-28 20:22:11', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','128','0','','0','0.00','0','0','0','0'); -- id=1124
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 = 1124;
 INSERT INTO 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-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 128, 104, 104
                    , 104, 104, 104, 104
                    , 0, 0, 0, 0
                    , 0, 0, 0, 104, 104, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+104
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+104, sellCostMeanBuyPrice = sellCostMeanBuyPrice+104
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+104
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+104
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+104
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '691', userid = '1', storedetaildate = '2026-09-28 20:22:11' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '16', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '707', '691', '1', '2026-09-28 20:22:11','0','0'); -- id=2256
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '161', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-09-28 20:22:11', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','720','0','','0','0.00','0','0','0','0'); -- id=1125
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 = 1125;
 INSERT INTO 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-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '857', userid = '1', storedetaildate = '2026-09-28 20:22:11' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '872', '857', '1', '2026-09-28 20:22:11','0','0'); -- id=2257
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157.92','00186', '161', '20', '186', '1.00', '165', '165', '0', '', '1', '2026-09-28 20:22:11', '186', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','165','165','0','','0','0.00','0','0','0','0'); -- id=1126
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 1126;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '1', storedetaildate = '2026-09-28 20:22:11' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '123', '1', '2026-09-28 20:22:12','0','0'); -- id=2258
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('139.2','00185', '161', '20', '185', '2.00', '150', '300', '0', '', '1', '2026-09-28 20:22:12', '185', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=1127
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 1127;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '221', userid = '1', storedetaildate = '2026-09-28 20:22:12' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '223', '221', '1', '2026-09-28 20:22:12','0','0'); -- id=2259
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8','00530', '161', '6', '530', '1.00', '10', '10', '0', '', '1', '2026-09-28 20:22:12', '530', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10','10','0','','0','0.00','0','0','0','0'); -- id=1128
UPDATE sellbilldetail SET  lastbuyprice = 8.00 , meanbuyprice = 8.00, lastbuyprice_withDiscount = 8.00, meanbuyprice_withDiscount = 8.00
        , lastbuyprice_withTax = 8, meanbuyprice_withTax = 8, lastbuyprice_withDiscountAndTax = 8
                where sellbilldetailid = 1128;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (530, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 10, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 20:22:12' WHERE storedetailid = '530';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('530', '1', '1', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 20:22:12','0','0'); -- id=2260
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('23','00529', '161', '6', '529', '3.00', '26', '78', '0', '', '1', '2026-09-28 20:22:12', '529', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','78','0','','0','0.00','0','0','0','0'); -- id=1129
UPDATE sellbilldetail SET  lastbuyprice = 23.00 , meanbuyprice = 23.00, lastbuyprice_withDiscount = 23.00, meanbuyprice_withDiscount = 23.00
        , lastbuyprice_withTax = 23, meanbuyprice_withTax = 23, lastbuyprice_withDiscountAndTax = 23
                where sellbilldetailid = 1129;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (529, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 78, 69, 69
                    , 69, 69, 69, 69
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69, 69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+78, sellCostBuyPrice =sellCostBuyPrice+69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-09-28 20:22:12' WHERE storedetailid = '529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('529', '1', '3', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '27', '1', '2026-09-28 20:22:13','0','0'); -- id=2261
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '161', '6', '527', '1.00', '23', '23', '0', '', '1', '2026-09-28 20:22:13', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=1130
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 1130;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 20:22:13' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-28 20:22:13','0','0'); -- id=2262
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157','00531', '161', '10', '531', '44.00', '175', '7700', '0', '', '1', '2026-09-28 20:22:13', '531', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','175','7700','0','','0','0.00','0','0','0','0'); -- id=1131
UPDATE sellbilldetail SET  lastbuyprice = 157.00 , meanbuyprice = 157.00, lastbuyprice_withDiscount = 157.00, meanbuyprice_withDiscount = 157.00
        , lastbuyprice_withTax = 157, meanbuyprice_withTax = 157, lastbuyprice_withDiscountAndTax = 157
                where sellbilldetailid = 1131;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (531, '2026-09-28', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 44, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7700, sellCostBuyPrice =sellCostBuyPrice+6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6908
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+44
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 7700, 6908, 6908
                    , 6908, 6908, 6908, 6908
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6908, 6908, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7700, sellCostBuyPrice =sellCostBuyPrice+6908
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6908, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6908
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6908, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6908
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6908
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6908
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6908
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-28 20:22:13' WHERE storedetailid = '531';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('531', '1', '44', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '0', '1', '2026-09-28 20:22:13','0','0'); -- id=2263
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00002', '161', '10', '2', '15', '88', '1320', '0', '', '1', '2026-09-28 20:22:13', '2', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','88','1320','0','','0','0.00','0','0','0','0'); -- id=1132
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 80.00, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 80.00
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 80, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 1132;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-09-28', 1320, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1320, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '110', userid = '1', storedetaildate = '2026-09-28 20:22:14' WHERE storedetailid = '2';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2', '1', '15', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '125', '110', '1', '2026-09-28 20:22:14','0','0'); -- id=2264
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 24;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('101','00108', '161', '3', '108', '12', '103', '1236', '0', '', '1', '2026-09-28 20:22:14', '108', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','24-9,','1','1','0','0','103','1236','0','','0','0.00','0','0','0','0'); -- id=1133
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 = 1133;
 INSERT INTO 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-09-28', 1236, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1236, sellCostBuyPrice =sellCostBuyPrice+1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 1236, 1212, 1212
                    , 1212, 1212, 1212, 1212
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1212, 1212, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1236, sellCostBuyPrice =sellCostBuyPrice+1212
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1212, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1212
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1212, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1212
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1212
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1212
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1212
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-28 20:22:14' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '12', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '20', '1', '2026-09-28 20:22:14','0','0'); -- id=2265
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('116','00111', '161', '3', '111', '6', '120', '720', '0', '', '1', '2026-09-28 20:22:14', '111', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','720','0','','0','0.00','0','0','0','0'); -- id=1134
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 1134;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (111, '2026-09-28', 720, 696, 696
                    , 696, 696, 696, 696
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 696, 696, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+696
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+696
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+696
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+696
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 720, 696, 696
                    , 696, 696, 696, 696
                    , 0, 0, 0, 0
                    , 0, 0, 0, 696, 696, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+696
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+696, sellCostMeanBuyPrice = sellCostMeanBuyPrice+696
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+696, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+696
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+696
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+696
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+696
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-09-28 20:22:14' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '6', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '27', '21', '1', '2026-09-28 20:22:14','0','0'); -- id=2266
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('116','00112', '161', '3', '112', '4', '120', '480', '0', '', '1', '2026-09-28 20:22:14', '112', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','480','0','','0','0.00','0','0','0','0'); -- id=1135
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 1135;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (112, '2026-09-28', 480, 464, 464
                    , 464, 464, 464, 464
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 464, 464, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+464
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+464, sellCostMeanBuyPrice = sellCostMeanBuyPrice+464
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+464
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+464
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 480, 464, 464
                    , 464, 464, 464, 464
                    , 0, 0, 0, 0
                    , 0, 0, 0, 464, 464, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+464
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+464, sellCostMeanBuyPrice = sellCostMeanBuyPrice+464
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+464, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+464
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+464
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+464
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+464
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-09-28 20:22:15' WHERE storedetailid = '112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '1', '4', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '16', '1', '2026-09-28 20:22:15','0','0'); -- id=2267
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00450', '161', '6', '450', '3', '15', '45', '0', '', '1', '2026-09-28 20:22:15', '450', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','45','0','','0','0.00','0','0','0','0'); -- id=1136
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 = 1136;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (450, '2026-09-28', 45, 39, 39
                    , 39, 39, 39, 39
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 39, 39, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39, sellCostMeanBuyPrice = sellCostMeanBuyPrice+39
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+39
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 45, 39, 39
                    , 39, 39, 39, 39
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39, 39, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39, sellCostMeanBuyPrice = sellCostMeanBuyPrice+39
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+39
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-28 20:22:15' WHERE storedetailid = '450';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('450', '1', '3', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '0', '1', '2026-09-28 20:22:15','0','0'); -- id=2268
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 34;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('12','00344', '161', '6', '344', '2', '15', '30', '0', '', '1', '2026-09-28 20:22:15', '344', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','34-2,','1','1','0','0','15','30','0','','0','0.00','0','0','0','0'); -- id=1137
UPDATE sellbilldetail SET  lastbuyprice = 12.00 , meanbuyprice = 12.00, lastbuyprice_withDiscount = 12.00, meanbuyprice_withDiscount = 12.00
        , lastbuyprice_withTax = 12, meanbuyprice_withTax = 12, lastbuyprice_withDiscountAndTax = 12
                where sellbilldetailid = 1137;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (344, '2026-09-28', 30, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 30, 24, 24
                    , 24, 24, 24, 24
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 24, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+24
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-09-28 20:22:15' WHERE storedetailid = '344';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('344', '1', '2', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '28', '1', '2026-09-28 20:22:15','0','0'); -- id=2269
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35','00343', '161', '6', '343', '1', '40', '40', '0', '', '1', '2026-09-28 20:22:15', '343', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','40','40','0','','0','0.00','0','0','0','0'); -- id=1138
UPDATE sellbilldetail SET  lastbuyprice = 35.00 , meanbuyprice = 35.00, lastbuyprice_withDiscount = 35.00, meanbuyprice_withDiscount = 35.00
        , lastbuyprice_withTax = 35, meanbuyprice_withTax = 35, lastbuyprice_withDiscountAndTax = 35
                where sellbilldetailid = 1138;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (343, '2026-09-28', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-09-28 20:22:16' WHERE storedetailid = '343';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('343', '1', '1', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '24', '1', '2026-09-28 20:22:16','0','0'); -- id=2270
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('32','00440', '161', '12', '440', '2', '36', '72', '0', '', '1', '2026-09-28 20:22:16', '440', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','72','0','','0','0.00','0','0','0','0'); -- id=1139
UPDATE sellbilldetail SET  lastbuyprice = 32.00 , meanbuyprice = 32.00, lastbuyprice_withDiscount = 32.00, meanbuyprice_withDiscount = 32.00
        , lastbuyprice_withTax = 32, meanbuyprice_withTax = 32, lastbuyprice_withDiscountAndTax = 32
                where sellbilldetailid = 1139;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (440, '2026-09-28', 72, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 72, 64, 64
                    , 64, 64, 64, 64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 64, 64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+64
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+64, sellCostMeanBuyPrice = sellCostMeanBuyPrice+64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+64, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+64
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '207', userid = '1', storedetaildate = '2026-09-28 20:22:16' WHERE storedetailid = '440';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('440', '1', '2', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '209', '207', '1', '2026-09-28 20:22:16','0','0'); -- id=2271
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('3.5','00446', '161', '12', '446', '6', '5', '30', '0', '', '1', '2026-09-28 20:22:16', '446', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','5','30','0','','0','0.00','0','0','0','0'); -- id=1140
UPDATE sellbilldetail SET  lastbuyprice = 3.50 , meanbuyprice = 3.50, lastbuyprice_withDiscount = 3.50, meanbuyprice_withDiscount = 3.50
        , lastbuyprice_withTax = 3.5, meanbuyprice_withTax = 3.5, lastbuyprice_withDiscountAndTax = 3.5
                where sellbilldetailid = 1140;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (446, '2026-09-28', 30, 21, 21
                    , 21, 21, 21, 21
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 21, 21, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+21, sellCostMeanBuyPrice = sellCostMeanBuyPrice+21
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+21
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+21
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 30, 21, 21
                    , 21, 21, 21, 21
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 21, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30, sellCostBuyPrice =sellCostBuyPrice+21
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+21, sellCostMeanBuyPrice = sellCostMeanBuyPrice+21
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+21, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+21
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+21
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+21
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+21
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '239', userid = '1', storedetaildate = '2026-09-28 20:22:16' WHERE storedetailid = '446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('446', '1', '6', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '245', '239', '1', '2026-09-28 20:22:16','0','0'); -- id=2272
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('20','00525', '161', '6', '525', '5', '23', '115', '0', '', '1', '2026-09-28 20:22:16', '525', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','115','0','','0','0.00','0','0','0','0'); -- id=1141
UPDATE sellbilldetail SET  lastbuyprice = 20.00 , meanbuyprice = 20.00, lastbuyprice_withDiscount = 20.00, meanbuyprice_withDiscount = 20.00
        , lastbuyprice_withTax = 20, meanbuyprice_withTax = 20, lastbuyprice_withDiscountAndTax = 20
                where sellbilldetailid = 1141;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (525, '2026-09-28', 115, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+115, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 115, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+115, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '19', userid = '1', storedetaildate = '2026-09-28 20:22:17' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '5', '1', '161', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '19', '1', '2026-09-28 20:22:17','0','0'); -- id=2273
UPDATE dailyentry SET totalcreditor = '18804.00', totaldebtor = '18804.00', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 17:18:57', entryComment = 'اضافة فاتورة مبيعات رقم 159', fromFlag = '1',related='0',isopeningentry='0',operationId='159',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=159' WHERE id = '1064';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18804.00', '18804.00', '2026-09-28', '1', '0', '1064', '2026-09-28 20:22:17','تم عكس القيد رقم 1064 ','1','0','0','0','0',''); -- id=1070
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1070', '430', '18804.00', '','0'); -- id=1070
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '-6268.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1070', '143', '18804.00', '','0'); -- id=1070
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '578058.82', 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 = '16505.12', totaldebtor = '16505.12', thedate = '2026-09-28', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-28 17:18:57', entryComment = 'اضافة فاتورة مبيعات رقم 159 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='159',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=159' WHERE id = '1065';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16505.12', '16505.12', '2026-09-28', '1', '0', '1065', '2026-09-28 20:22:18','تم عكس القيد رقم 1065 ','1','0','0','0','0',''); -- id=1071
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1071', '402', '16505.12', '','0'); -- id=1071
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '534562.91', 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 ('1071', '382', '16505.12', '','0'); -- id=1071
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2507647.76', 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 ( '22892', '22892', '2026-09-28', '1', '0', '0', '2026-09-28 20:22:18','اضافة فاتورة مبيعات رقم 161','1','0',null,'0','161','sellbillController.php?do=showDetail&sellbillid=161'); -- id=1072
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1072', '430', '22892', '','0'); -- id=1072
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '16623.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1072', '143', '22892', '','0'); -- id=1072
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '600950.82', 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 ( '20360.12', '20360.12', '2026-09-28', '1', '0', '0', '2026-09-28 20:22:18','اضافة فاتورة مبيعات رقم 161 - صرف البضاعة من المخزن','1','0',null,'0','161','sellbillController.php?do=showDetail&sellbillid=161'); -- id=1073
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1073', '402', '20360.12', '','0'); -- id=1073
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '554923.03', 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 ('1073', '382', '20360.12', '','0'); -- id=1073
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2487287.64', 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='1072,0,1073' where sellbillid=161;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 22892, 20360.12, 20360.12
                    , 20288.12, 20360.12, 20288.12, 20360.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20360.12, 20288.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22892, sellCostBuyPrice =sellCostBuyPrice+20360.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20360.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20288.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20360.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20288.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20360.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20360.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20288.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-28', 22892, 20360.12, 20360.12
                    , 20288.12, 20360.12, 20288.12, 20360.12
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,20360.12, 20288.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22892, sellCostBuyPrice =sellCostBuyPrice+20360.12
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20360.12, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20288.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20360.12, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20288.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20360.12
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20360.12
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20288.12
                        , returnSellVal = returnSellVal+0, 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, 22892, 20360.12, 20360.12
                    , 20288.12, 20360.12, 20288.12, 20360.12, 20360.12, 20288.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+22892, netSellCostBuyPrice = netSellCostBuyPrice+20360.12
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+20360.12
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+20288.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20360.12
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+20288.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+20360.12
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+20360.12
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+20288.12;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 159 and newid=161 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:52:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:22:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:22:19', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=161'); -- id=2792
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:53:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:23:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 20:23:16', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2793
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:53:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:23:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 20:23:21', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2794
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:55:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:25:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:25:26', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=36'); -- id=2795
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:56:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:26:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-28 20:26:21', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=2796
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:56:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:26:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-28 20:26:30', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=2797
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 16:56:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:26:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-09-28 20:26:46', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=2798
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 17:02:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:32:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:32:07', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2799
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 ('احمد سعد' , '', '', '', '6300', '', '0', '2026-09-28 20:32:27', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-28','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=41
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('41', '0', '0', '', ''); -- id=41
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 ('41','0','6300','0','إضافة عميل جديد','41', '6300', '2026-09-28 20:32:27', '1', 'clientController.php', '', '6300', '0', null, '0', null, null,'', '0','1','1','6300','1','','0','0','',''); -- id=273
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('احمد سعد', 'احمد سعد', 'احمد سعد', 'احمد سعد', '58', '0', '0', '0', '', '1', '1', '', '0', '3', '1', '', '1', '0', '2026-09-28 20:32:28'); -- id=473
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6300', '6300', '2026-09-28', '1', '0', '0', '2026-09-28 20:32:28','تم اضافة عميل احمد سعد','1','0','0','0','41','clientController.php?do=edit&id=41'); -- id=1074
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1074', '473', '6300', '','0'); -- id=1074
UPDATE accountstree SET name = 'احمد سعد', customName = 'احمد سعد', customNameEn = 'احمد سعد', nameEn = 'احمد سعد', parent = '58', accountNature = '0', theValue = '6300', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 20:32:28' WHERE id = '473';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1074', '121', '6300', '','0'); -- id=1074
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1543975.87', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
COMMIT;
UPDATE client SET clientname = 'احمد سعد', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '6300.00', clientdetails = '', conditions = '0', clientdate = '2026-09-28', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '1074' , 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='473',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 = '41';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 17:05:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:35:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:35:02', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2800

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06abab2a801bce
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(41,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-28 20:35:03', '06abab2a801bce', '41', '6300.00', '7786', '0', '1', '1486.00', '1486', '0', '1486', '1', '2026-09-28 20:35:03', '', '1', '0', 'احمد سعد', '1', '1', '3', '0', 'احمد سعد', '22.5' ,'0','','','','','-1','0','0','0','0','0','1486','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-28','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=162
UPDATE client SET  clientdebt = '7786', userid = '1' WHERE clientid = '41';
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 ('41','6300.00','1486','0','اضافة فاتورة مبيعات','162', '7786', '2026-09-28 20:35:04', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1486', '0', null, '0', null, null,'', '0','1','1','1486','1','2026-09-28 20:35:03','0','0','',''); -- id=274
UPDATE client SET  inUse = 0 where clientid = 41;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('60','00298', '162', '6', '298', '1', '75', '75', '0', '', '1', '2026-09-28 20:35:04', '298', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','75','75','0','','0','0.00','0','0','0','0'); -- id=1142
UPDATE sellbilldetail SET  lastbuyprice = 60.00 , meanbuyprice = 60.00, lastbuyprice_withDiscount = 60.00, meanbuyprice_withDiscount = 60.00
        , lastbuyprice_withTax = 60, meanbuyprice_withTax = 60, lastbuyprice_withDiscountAndTax = 60
                where sellbilldetailid = 1142;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (298, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 75, 60, 60
                    , 60, 60, 60, 60
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 60, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+60
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+60, sellCostMeanBuyPrice = sellCostMeanBuyPrice+60
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+60, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+60
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+60
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+60
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+60
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-09-28 20:35:04' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '1', '1', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '8', '1', '2026-09-28 20:35:04','0','0'); -- id=2274
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '162', '1', '56', '1', '88.5', '88.5', '0', '', '1', '2026-09-28 20:35: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=1143
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 = 1143;
 INSERT INTO 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-09-28', 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-09-28', 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 = '19', userid = '1', storedetaildate = '2026-09-28 20:35: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', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '19', '1', '2026-09-28 20:35:04','0','0'); -- id=2275
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('7.5','00296', '162', '6', '296', '3', '9', '27', '0', '', '1', '2026-09-28 20:35:05', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','9','27','0','','0','0.00','0','0','0','0'); -- id=1144
UPDATE sellbilldetail SET  lastbuyprice = 7.50 , meanbuyprice = 7.50, lastbuyprice_withDiscount = 7.50, meanbuyprice_withDiscount = 7.50
        , lastbuyprice_withTax = 7.5, meanbuyprice_withTax = 7.5, lastbuyprice_withDiscountAndTax = 7.5
                where sellbilldetailid = 1144;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (296, '2026-09-28', 27, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 27, 22.5, 22.5
                    , 22.5, 22.5, 22.5, 22.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.5, 22.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27, sellCostBuyPrice =sellCostBuyPrice+22.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '65', userid = '1', storedetaildate = '2026-09-28 20:35:05' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '3', '1', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '68', '65', '1', '2026-09-28 20:35:05','0','0'); -- id=2276
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30','00271', '162', '10', '271', '13', '39', '507', '0', '', '1', '2026-09-28 20:35:05', '271', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','507','0','','0','0.00','0','0','0','0'); -- id=1145
UPDATE sellbilldetail SET  lastbuyprice = 30.00 , meanbuyprice = 30.00, lastbuyprice_withDiscount = 30.00, meanbuyprice_withDiscount = 30.00
        , lastbuyprice_withTax = 30, meanbuyprice_withTax = 30, lastbuyprice_withDiscountAndTax = 30
                where sellbilldetailid = 1145;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (271, '2026-09-28', 507, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+507, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+390
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+13
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 507, 390, 390
                    , 390, 390, 390, 390
                    , 0, 0, 0, 0
                    , 0, 0, 0, 390, 390, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+507, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+390
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+390
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2026-09-28 20:35:05' WHERE storedetailid = '271';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('271', '1', '13', '1', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '70', '57', '1', '2026-09-28 20:35:05','0','0'); -- id=2277
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '162', '14', '80', '.5', '95', '47.5', '0', '', '1', '2026-09-28 20:35:05', '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=1146
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 = 1146;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (80, '2026-09-28', 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-09-28', 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 = '7.9', userid = '1', storedetaildate = '2026-09-28 20:35:06' 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', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8.4', '7.9', '1', '2026-09-28 20:35:06','0','0'); -- id=2278
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00009', '162', '1', '9', '2', '319', '638', '0', '', '1', '2026-09-28 20:35:06', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','71-2,','1','1','0','0','319','638','0','','0','0.00','0','0','0','0'); -- id=1147
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 = 1147;
 INSERT INTO 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-09-28', 638, 612, 612
                    , 612, 612, 612, 612
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 612, 612, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+638, sellCostBuyPrice =sellCostBuyPrice+612
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+612, sellCostMeanBuyPrice = sellCostMeanBuyPrice+612
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+612, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+612
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+612
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+612
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+612
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 638, 612, 612
                    , 612, 612, 612, 612
                    , 0, 0, 0, 0
                    , 0, 0, 0, 612, 612, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+638, sellCostBuyPrice =sellCostBuyPrice+612
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+612, sellCostMeanBuyPrice = sellCostMeanBuyPrice+612
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+612, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+612
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+612
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+612
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+612
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2026-09-28 20:35:06' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '2', '1', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '54', '1', '2026-09-28 20:35:06','0','0'); -- id=2279
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 17;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('69.5','00318', '162', '7', '318', '1', '75', '75', '0', '', '1', '2026-09-28 20:35:06', '318', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','17-1,','1','1','0','0','75','75','0','','0','0.00','0','0','0','0'); -- id=1148
UPDATE sellbilldetail SET  lastbuyprice = 69.50 , meanbuyprice = 68.78, lastbuyprice_withDiscount = 69.50, meanbuyprice_withDiscount = 68.78
        , lastbuyprice_withTax = 69.5, meanbuyprice_withTax = 68.78, lastbuyprice_withDiscountAndTax = 69.5
                where sellbilldetailid = 1148;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (318, '2026-09-28', 75, 69.5, 69.5
                    , 68.78, 69.5, 68.78, 69.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 69.5, 68.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+69.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+68.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+68.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+68.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
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 75, 69.5, 69.5
                    , 68.78, 69.5, 68.78, 69.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69.5, 68.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+69.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+68.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+68.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+68.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;
UPDATE storedetail SET  productquantity = '59', userid = '1', storedetaildate = '2026-09-28 20:35:06' WHERE storedetailid = '318';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('318', '1', '1', '1', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '59', '1', '2026-09-28 20:35:06','0','0'); -- id=2280
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 99;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('24.8','00291', '162', '24', '291', '1', '28', '28', '0', '', '1', '2026-09-28 20:35:06', '291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','99-1,','1','1','0','0','28','28','0','','0','0.00','0','0','0','0'); -- id=1149
UPDATE sellbilldetail SET  lastbuyprice = 24.80 , meanbuyprice = 24.80, lastbuyprice_withDiscount = 24.80, meanbuyprice_withDiscount = 24.80
        , lastbuyprice_withTax = 24.8, meanbuyprice_withTax = 24.8, lastbuyprice_withDiscountAndTax = 24.8
                where sellbilldetailid = 1149;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (291, '2026-09-28', 28, 24.8, 24.8
                    , 24.8, 24.8, 24.8, 24.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 24.8, 24.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+24.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-28', 28, 24.8, 24.8
                    , 24.8, 24.8, 24.8, 24.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24.8, 24.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+24.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '1', storedetaildate = '2026-09-28 20:35:07' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '1', '1', '162', 'اضافة فاتورة مبيعات', 'sellbillController.php', '79', '78', '1', '2026-09-28 20:35:07','0','0'); -- id=2281
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1486', '1486', '2026-09-28', '1', '0', '0', '2026-09-28 20:35:07','اضافة فاتورة مبيعات رقم 162','1','0',null,'0','162','sellbillController.php?do=showDetail&sellbillid=162'); -- id=1075
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1075', '473', '1486', '','0'); -- id=1075
UPDATE accountstree SET name = 'احمد سعد', customName = 'احمد سعد', customNameEn = 'احمد سعد', nameEn = 'احمد سعد', parent = '58', accountNature = '0', theValue = '7786', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 20:32:28' WHERE id = '473';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1075', '143', '1486', '','0'); -- id=1075
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '602436.82', 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 ( '1304.2', '1304.2', '2026-09-28', '1', '0', '0', '2026-09-28 20:35:07','اضافة فاتورة مبيعات رقم 162 - صرف البضاعة من المخزن','1','0',null,'0','162','sellbillController.php?do=showDetail&sellbillid=162'); -- id=1076
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1076', '402', '1304.2', '','0'); -- id=1076
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '556227.23', 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 ('1076', '382', '1304.2', '','0'); -- id=1076
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2485983.44', 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='1075,0,1076' where sellbillid=162;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-28', 1486, 1304.2, 1304.2
                    , 1303.48, 1304.2, 1303.48, 1304.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1304.2, 1303.48, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1486, sellCostBuyPrice =sellCostBuyPrice+1304.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1304.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1303.48
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1304.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1303.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1304.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1304.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1303.48
                        , returnSellVal = returnSellVal+0, 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 (41, '2026-09-28', 1486, 1304.2, 1304.2
                    , 1303.48, 1304.2, 1303.48, 1304.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1304.2, 1303.48, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1486, sellCostBuyPrice =sellCostBuyPrice+1304.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1304.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1303.48
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1304.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1303.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1304.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1304.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1303.48
                        , returnSellVal = returnSellVal+0, 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, 1486, 1304.2, 1304.2
                    , 1303.48, 1304.2, 1303.48, 1304.2, 1304.2, 1303.48)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1486, netSellCostBuyPrice = netSellCostBuyPrice+1304.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1304.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1303.48
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1304.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1303.48
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1304.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1304.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1303.48;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06abab2a801bce and sellbillId = 162 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 17:05:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 20:35:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 20:35:08', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2801
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:19:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 21:49:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 21:49:26', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:19:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 21:49:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-28 21:49:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2803
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:19:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 21:49:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 21:49:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2804
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:25:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 21:55:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 21:55:54', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2805
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:25:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 21:56:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 21:56:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2806
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:26:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 21:56:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 21:56:13', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=161'); -- id=2807
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:31:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:01:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-28 22:01:57', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=2808
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:31:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:01:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-28 22:01:58', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2809
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:32:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:02:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-28 22:02:06', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2810
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:32:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:02:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 22:02:13', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2811
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:32:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:02:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 22:02:22', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2812
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:32:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:02:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-28 22:02:27', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=144'); -- id=2813
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:32:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:02:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 22:02:49', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2814
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:32:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:02:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 22:02:58', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2815
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:33:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:03:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2026-09-28 22:03:06', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/returnsellbillController.php?do=showDetail&returnsellbillid=9'); -- id=2816
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:33:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:03:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-28 22:03:35', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2817
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:33:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:03:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 22:03:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2818
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-28 18:34:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-28 22:04:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-28 22:04:01', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2819
