UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:51:16";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:51:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:21:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-20 09:21:22', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=1644
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-20',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-20 05:51:28";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-20 09:21:28', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=1645
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:51:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:21:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-20 09:21:38', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=1646
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:51:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:21:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 09:21:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=1647
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:51:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:21:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 09:21:57', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=1648
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:53:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:23:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:23:07', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1649
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:53:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:23:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 09:23:41', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=1650
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:53:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:23:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 09:23:42', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=1651
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:54:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:24:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 09:24:38', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=1652
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:54:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:24:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 09:24:39', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=1653
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:55:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:25:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:25:47', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1654
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:55:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:25:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:25:54', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1655
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:55:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:25:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:25:55', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1656
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:55:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:25:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:25:55', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1657
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:56:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:26:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:26:01', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1658
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:56:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:26:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:26:07', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1659
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:56:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:26:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:26:15', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1660
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:56:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:26:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:26:16', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1661
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:56:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:26:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:26:22', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1662
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:59:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:29:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:29:13', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1663
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:59:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:29:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:29:20', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1664
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:59:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:29:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:29:26', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1665
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:59:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:29:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:29:36', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1666
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 05:59:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:29:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 09:29:52', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1667
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 06:10:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:40:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:40:30', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1668
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 06:11:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:41:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:41:11', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 06:11:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:41:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:41:32', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1670
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 06:11:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:41:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:41:42', '1', 'all', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=all'); -- id=1671
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 06:11:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:41:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:41:57', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1672
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 06:12:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 09:42:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 09:42:02', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1673
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:21:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:51:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-20 10:51:35', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=1674
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-20 07:21:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:51:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-20 10:51:40', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=1675
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-20 07:21:43";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-20 10:51:43', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=1676
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:21:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:51:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 10:51:54', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=1677
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:22:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:52:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 10:52:03', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1678
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:22:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:52:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 10:52:32', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1679

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaf9eb64c9da
-- ----------------------------------------------------------------------------------------------------

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-20 10:52:33', '06aaf9eb64c9da', '1', '0.00', '0', '0', '1', '2400.00', '2400', '2400', '0', '1', '2026-09-20 10:52:33', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','2400','0','','0','0','2400','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=63
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','اضافة فاتورة مبيعات','63', '0', '2026-09-20 10:52:34', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2400', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 10:52:33','0','0','',''); -- id=100
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2350','00389', '63', '6', '389', '1', '2400', '2400', '0', '', '1', '2026-09-20 10:52:34', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','18-1,','1','1','0','0','2400','2400','0','','0','0.00','0','0','0','0'); -- id=428
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 428;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-20', 2400, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2400, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-20 10:52:34' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '63', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-09-20 10:52:34','0','0'); -- id=1097
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-200954.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-203354.984375','2400', '0', '1', 'اضافة فاتورة مبيعات', '63', '-200954.984375', '2026-09-20 10:52:34', '1',  'sellbillController.php','1','','0'); -- id=59
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2400', '2400', '2026-09-20', '1', '0', '0', '2026-09-20 10:52:34','اضافة فاتورة مبيعات رقم 63','1','0',null,'0','63','sellbillController.php?do=showDetail&sellbillid=63'); -- id=635
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('635', '383', '2400', '','0'); -- id=635
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-154262.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('635', '143', '2400', '','0'); -- id=635
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '190564.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2350', '2350', '2026-09-20', '1', '0', '0', '2026-09-20 10:52:34','اضافة فاتورة مبيعات رقم 63 - صرف البضاعة من المخزن','1','0',null,'0','63','sellbillController.php?do=showDetail&sellbillid=63'); -- id=636
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('636', '402', '2350', '','0'); -- id=636
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '179452.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('636', '382', '2350', '','0'); -- id=636
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2110424.11', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='635,0,636' where sellbillid=63;
 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-20', 2400, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 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-20', 2400, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2400, 2350, 2350
                    , 2350, 2350, 2350, 2350, 2350, 2350)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2400, netSellCostBuyPrice = netSellCostBuyPrice+2350
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2350
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2350
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2350
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2350
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2350
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2350
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2350;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaf9eb64c9da and sellbillId = 63 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:22:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:52:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 10:52:36', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1680
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:24:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:54:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 10:54:32', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1681

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaf9ed51b835
-- ----------------------------------------------------------------------------------------------------

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-20 10:54:33', '06aaf9ed51b835', '1', '0.00', '0', '0', '1', '7910.00', '7910', '7910', '0', '1', '2026-09-20 10:54:33', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','7910','0','','0','0','7910','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=64
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','اضافة فاتورة مبيعات','64', '0', '2026-09-20 10:54:34', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7910', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 10:54:33','0','0','',''); -- id=101
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2350','00389', '64', '6', '389', '1', '2430', '2430', '0', '', '0', '2026-09-20 10:54:34', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','18-1,','1','1','0','0','2430','2430','0','','0','','0','0','0','0'); -- id=429
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 429;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-20', 2430, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2430, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2430, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2430, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-20 10:54:34' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '64', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-09-20 10:54:34','0','0'); -- id=1098
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 20;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5382','00391', '64', '6', '391', '1', '5480', '5480', '0', '', '0', '2026-09-20 10:54:34', '391', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','20-1,','1','1','0','0','5480','5480','0','','0','0.00','0','0','0','0'); -- id=430
UPDATE sellbilldetail SET  lastbuyprice = 5382.00 , meanbuyprice = 5382.00, lastbuyprice_withDiscount = 5382.00, meanbuyprice_withDiscount = 5382.00
        , lastbuyprice_withTax = 5382, meanbuyprice_withTax = 5382, lastbuyprice_withDiscountAndTax = 5382
                where sellbilldetailid = 430;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (391, '2026-09-20', 5480, 5382, 5382
                    , 5382, 5382, 5382, 5382
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5382, 5382, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5480, sellCostBuyPrice =sellCostBuyPrice+5382
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5382, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5382
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5382, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5382
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5382
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5382
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5382
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 5480, 5382, 5382
                    , 5382, 5382, 5382, 5382
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5382, 5382, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5480, sellCostBuyPrice =sellCostBuyPrice+5382
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5382, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5382
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5382, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5382
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5382
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5382
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5382
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 10:54:34' WHERE storedetailid = '391';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '1', '1', '1', '64', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-09-20 10:54:35','0','0'); -- id=1099
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-193044.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-200954.984375','7910', '0', '1', 'اضافة فاتورة مبيعات', '64', '-193044.984375', '2026-09-20 10:54:35', '1',  'sellbillController.php','1','','0'); -- id=60
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7910', '7910', '2026-09-20', '1', '0', '0', '2026-09-20 10:54:35','اضافة فاتورة مبيعات رقم 64','1','0',null,'0','64','sellbillController.php?do=showDetail&sellbillid=64'); -- id=637
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('637', '383', '7910', '','0'); -- id=637
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-146352.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('637', '143', '7910', '','0'); -- id=637
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '198474.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7732', '7732', '2026-09-20', '1', '0', '0', '2026-09-20 10:54:35','اضافة فاتورة مبيعات رقم 64 - صرف البضاعة من المخزن','1','0',null,'0','64','sellbillController.php?do=showDetail&sellbillid=64'); -- id=638
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('638', '402', '7732', '','0'); -- id=638
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '187184.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('638', '382', '7732', '','0'); -- id=638
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2102692.11', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='637,0,638' where sellbillid=64;
 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-20', 7910, 7732, 7732
                    , 7732, 7732, 7732, 7732
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7732, 7732, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7910, sellCostBuyPrice =sellCostBuyPrice+7732
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7732, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7732
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7732, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7732
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7732
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7732
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7732
                        , returnSellVal = returnSellVal+0, 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-20', 7910, 7732, 7732
                    , 7732, 7732, 7732, 7732
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7732, 7732, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7910, sellCostBuyPrice =sellCostBuyPrice+7732
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7732, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7732
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7732, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7732
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7732
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7732
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7732
                        , returnSellVal = returnSellVal+0, 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, 7910, 7732, 7732
                    , 7732, 7732, 7732, 7732, 7732, 7732)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7910, netSellCostBuyPrice = netSellCostBuyPrice+7732
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7732
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7732
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7732
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7732
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7732
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7732
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7732;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaf9ed51b835 and sellbillId = 64 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:24:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 10:54:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 10:54:36', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1682
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:33:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:03:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:03:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=1683
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:34:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:04:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:04:36', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1684

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafa177b4c64
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-09-20 11:04:36', '06aafa177b4c64', '1', '0.00', '0', '0', '1', '8030', '8030', '-8030', '0', '1', '2026-09-20 11:04:36', '', '1', '0', 'نقدي','1', '0', '5', '0', 'نقدي', '2', '0', '', '','','','-1','0','0','0','','0','-8030','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=2
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','2', '0', '2026-09-20 11:04:37', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '8030', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 11:04:36','0','0','',''); -- id=102
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('2350.00', '00389', '2', '6', '389', '1', '2430', '2430', '0', '', '1', '0', '389', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','2430','2430','0','','0'); -- id=3
UPDATE returnsellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where returnsellbilldetailid = 3;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2430, 2350, 2350, 2350
                    , 2350, 2350, 2350, 0, 1, 0, 0, 2350, 2350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+2430, returnSellCostBuyPrice = returnSellCostBuyPrice+2350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2350
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2350
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2350
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2350
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2430, 2350, 2350, 2350
                    , 2350, 2350, 2350, 0, 0, 2350, 2350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+2430, returnSellCostBuyPrice = returnSellCostBuyPrice+2350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2350
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2350
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2350
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2350;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-09-20 11:04:37' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '0', '2', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '1', '1', '2026-09-20 11:04:37','0','0'); -- id=1100
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('5382.00', '00391', '2', '6', '391', '1', '5600', '5600', '0', '', '1', '0', '391', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','5600','5600','0','','0'); -- id=4
UPDATE returnsellbilldetail SET  lastbuyprice = 5382.00 , meanbuyprice = 5382.00, lastbuyprice_withDiscount = 5382.00, meanbuyprice_withDiscount = 5382.00
        , lastbuyprice_withTax = 5382, meanbuyprice_withTax = 5382, lastbuyprice_withDiscountAndTax = 5382
                where returnsellbilldetailid = 4;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (391, '2026-09-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 5600, 5382, 5382, 5382
                    , 5382, 5382, 5382, 0, 1, 0, 0, 5382, 5382)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+5600, returnSellCostBuyPrice = returnSellCostBuyPrice+5382, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+5382
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+5382, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+5382
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+5382
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+5382
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+5382
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+5382
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 5600, 5382, 5382, 5382
                    , 5382, 5382, 5382, 0, 0, 5382, 5382)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+5600, returnSellCostBuyPrice = returnSellCostBuyPrice+5382, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+5382
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+5382, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+5382
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+5382
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+5382
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+5382
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+5382;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-20 11:04:37' WHERE storedetailid = '391';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '1', '1', '0', '2', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1', '2', '1', '2026-09-20 11:04:37','0','0'); -- id=1101
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-201074.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-193044.984375','-8030', '1', '1', 'اضافة فاتورة مردوات مبيعات', '2', '-201074.984375', '2026-09-20 11:04:37', '1',  'returnsellbillController.php','1','','0'); -- id=61
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8030', '8030', '2026-09-20', '1', '0', '0', '2026-09-20 11:04:38','اضافة فاتورة مردود مبيعات رقم 2','1','0',null,'0','2','returnsellbillController.php?do=showDetail&returnsellbillid=2'); -- id=639
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('639', '143', '8030', '','0'); -- id=639
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '190444.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('639', '383', '8030', '','0'); -- id=639
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-154382.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7732', '7732', '2026-09-20', '1', '0', '0', '2026-09-20 11:04:38','اضافة فاتورة مردود مبيعات رقم 2 - صرف البضاعة من المخزن','1','0',null,'0','2','returnsellbillController.php?do=showDetail&returnsellbillid=2'); -- id=640
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('640', '382', '7732', '','0'); -- id=640
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2110424.11', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('640', '402', '7732', '','0'); -- id=640
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '179452.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='639,0,640' where returnsellbillid=2;
 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-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 8030, 7732, 7732, 7732
                    , 7732, 7732, 7732 ,0, 0, 7732, 7732)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+8030, returnSellCostBuyPrice = returnSellCostBuyPrice+7732, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+7732
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+7732, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+7732
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+7732
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+7732
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+7732
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+7732;
 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-20', 0, 0, 0
                    , 0, 0, 0, 0
                    , 8030, 7732, 7732, 7732
                    , 7732, 7732, 7732 ,0, 0, 7732, 7732)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+8030, returnSellCostBuyPrice = returnSellCostBuyPrice+7732, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+7732
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+7732, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+7732
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+7732
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+7732
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+7732
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+7732;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -8030, -7732, -7732
                    , -7732, -7732, -7732, -7732, -7732, -7732)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-8030, netSellCostBuyPrice = netSellCostBuyPrice+-7732
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-7732
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-7732
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-7732
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-7732
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-7732
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-7732
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-7732;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafa177b4c64 and sellbillId = 2 and returnsellbillId = 2
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:34:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:04:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:04:40', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=1685
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:34:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:04:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:04:58', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1686
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('محمد بسيوني الفرسان' , '', '', '', '0', '', '0', '2026-09-20 11:05:15', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=16
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('16', '0', '0', '', ''); -- id=16
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 ('16','0','0','0','إضافة عميل جديد','16', '0', '2026-09-20 11:05:15', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=103
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-20 11:05:16'); -- id=444
UPDATE client SET clientname = 'محمد بسيوني الفرسان', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='444',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 = '16';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:35:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:05:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:05:54', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1687

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafa1bb2d18d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(16,@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-20 11:05:55', '06aafa1bb2d18d', '16', '0.00', '3930', '0', '1', '7930.00', '7930', '4000', '3930', '1', '2026-09-20 11:05:55', '', '1', '0', 'محمد بسيوني الفرسان', '1', '1', '3', '0', 'محمد بسيوني الفرسان', '2' ,'0','','','','','-1','0','0','0','0','0','7930','0','','0','0','4000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=65
UPDATE client SET  clientdebt = '3930', userid = '1' WHERE clientid = '16';
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 ('16','0.00','3930','0','اضافة فاتورة مبيعات','65', '3930', '2026-09-20 11:05:55', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7930', '0', null, '0', null, null,'', '0','1','1','3930','1','2026-09-20 11:05:55','0','0','',''); -- id=104
UPDATE client SET  inUse = 0 where clientid = 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 ('2350','00389', '65', '6', '389', '1', '2450', '2450', '0', '', '0', '2026-09-20 11:05:56', '389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','2450','2450','0','','0','','0','0','0','0'); -- id=431
UPDATE sellbilldetail SET  lastbuyprice = 2350.00 , meanbuyprice = 2350.00, lastbuyprice_withDiscount = 2350.00, meanbuyprice_withDiscount = 2350.00
        , lastbuyprice_withTax = 2350, meanbuyprice_withTax = 2350, lastbuyprice_withDiscountAndTax = 2350
                where sellbilldetailid = 431;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (389, '2026-09-20', 2450, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2450, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2450, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2450, sellCostBuyPrice =sellCostBuyPrice+2350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-20 11:05:56' WHERE storedetailid = '389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('389', '1', '1', '1', '65', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-09-20 11:05:56','0','0'); -- id=1102
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 20;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5382','00391', '65', '6', '391', '1', '5480', '5480', '0', '', '0', '2026-09-20 11:05:56', '391', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','20-1,','1','1','0','0','5480','5480','0','','0','','0','0','0','0'); -- id=432
UPDATE sellbilldetail SET  lastbuyprice = 5382.00 , meanbuyprice = 5382.00, lastbuyprice_withDiscount = 5382.00, meanbuyprice_withDiscount = 5382.00
        , lastbuyprice_withTax = 5382, meanbuyprice_withTax = 5382, lastbuyprice_withDiscountAndTax = 5382
                where sellbilldetailid = 432;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (391, '2026-09-20', 5480, 5382, 5382
                    , 5382, 5382, 5382, 5382
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5382, 5382, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5480, sellCostBuyPrice =sellCostBuyPrice+5382
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5382, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5382
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5382, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5382
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5382
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5382
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5382
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 5480, 5382, 5382
                    , 5382, 5382, 5382, 5382
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5382, 5382, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5480, sellCostBuyPrice =sellCostBuyPrice+5382
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5382, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5382
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5382, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5382
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5382
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5382
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5382
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 11:05:56' WHERE storedetailid = '391';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '1', '1', '1', '65', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-09-20 11:05:56','0','0'); -- id=1103
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-197074.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-201074.984375','4000', '0', '1', 'اضافة فاتورة مبيعات', '65', '-197074.984375', '2026-09-20 11:05:56', '1',  'sellbillController.php','16','','0'); -- id=62
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7930', '7930', '2026-09-20', '1', '0', '0', '2026-09-20 11:05:57','اضافة فاتورة مبيعات رقم 65','1','0',null,'0','65','sellbillController.php?do=showDetail&sellbillid=65'); -- id=641
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('641', '444', '7930', '','0'); -- id=641
UPDATE accountstree SET name = 'محمد بسيوني الفرسان', customName = 'محمد بسيوني الفرسان', customNameEn = 'محمد بسيوني الفرسان', nameEn = 'محمد بسيوني الفرسان', parent = '58', accountNature = '0', theValue = '7930', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 11:05:16' WHERE id = '444';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('641', '143', '7930', '','0'); -- id=641
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '198374.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4000', '4000', '2026-09-20', '1', '0', '0', '2026-09-20 11:05:57','اضافة فاتورة مبيعات رقم 65 - تحصيل الفاتورة من العميل','1','0',null,'0','65','sellbillController.php?do=showDetail&sellbillid=65'); -- id=642
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('642', '383', '4000', '','0'); -- id=642
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-150382.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('642', '444', '4000', '','0'); -- id=642
UPDATE accountstree SET name = 'محمد بسيوني الفرسان', customName = 'محمد بسيوني الفرسان', customNameEn = 'محمد بسيوني الفرسان', nameEn = 'محمد بسيوني الفرسان', parent = '58', accountNature = '0', theValue = '3930', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 11:05:16' WHERE id = '444';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7732', '7732', '2026-09-20', '1', '0', '0', '2026-09-20 11:05:57','اضافة فاتورة مبيعات رقم 65 - صرف البضاعة من المخزن','1','0',null,'0','65','sellbillController.php?do=showDetail&sellbillid=65'); -- id=643
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('643', '402', '7732', '','0'); -- id=643
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '187184.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('643', '382', '7732', '','0'); -- id=643
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2102692.11', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='641,642,643' where sellbillid=65;
 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-20', 7930, 7732, 7732
                    , 7732, 7732, 7732, 7732
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7732, 7732, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7930, sellCostBuyPrice =sellCostBuyPrice+7732
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7732, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7732
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7732, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7732
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7732
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7732
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7732
                        , returnSellVal = returnSellVal+0, 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 (16, '2026-09-20', 7930, 7732, 7732
                    , 7732, 7732, 7732, 7732
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7732, 7732, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7930, sellCostBuyPrice =sellCostBuyPrice+7732
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7732, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7732
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7732, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7732
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7732
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7732
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7732
                        , returnSellVal = returnSellVal+0, 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, 7930, 7732, 7732
                    , 7732, 7732, 7732, 7732, 7732, 7732)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7930, netSellCostBuyPrice = netSellCostBuyPrice+7732
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7732
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7732
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7732
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7732
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7732
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7732
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7732;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafa1bb2d18d and sellbillId = 65 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:35:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:05:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:05:58', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1688
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:37:34";
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-20 07:37:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:07:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-20 11:07:48', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=1689
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-20 07:37:49";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-20 11:07:49', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=1690
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:38:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:08:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:08:13', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1691
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:50:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:20:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:20:05', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1692
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:50:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:20:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:20:41', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1693
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:51:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:21:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:21:41', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1694
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('علبه فيشر 6 ملي','','6','5.5','7','8','7','2026-09-20','0','1','0','','0','0','0','0','0','5.5','5.5','5.5','5.5','5.5','0','27.27','27.27','45.45','.','0','0','0','5.5','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','5.5','5.5','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','5.5','0','0','0','0','0','0','','','0','0','0','0'); -- id=419
UPDATE product SET productName = 'علبه فيشر 6 ملي', productDescription = '', productCatId = '6', productBuyPrice = '5.5', productSellAllPrice = '7', productSellUnitPrice = '8', productSellHalfPrice = '7', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00419',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '5.5',lastbuyprice_withDiscount = '5.5',meanbuyprice = '5.5',meanbuyprice_withDiscount = '5.5' , productbuypricereal = '5.5' , buypricereal_precentage = '0' , buytotal_precentage = '27.27' , buyhalf_precentage = '27.27' , buypart_precentage = '45.45',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='5.5',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='5.5',meanbuyprice_withTax='5.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='5.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '419';
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', '419', '1.00', '2026-09-20', '1', '0','0041901','7','7','8','5.5','','0','0','0','0','0','0','0','0','0','0'); -- id=419
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('419', '1', '65', '1', '2026-09-20'); -- id=419
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '1', '65', '0', '419', 'إضافة منتج', 'productController.php', '0', '65', '1', '2026-09-20','0','0'); -- id=1104
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (419, 1,'2026-09-20 11:21:43',1)
                ON DUPLICATE KEY UPDATE productid = 419, edited = 1, sysdate = '2026-09-20 11:21:43', userid = 1; -- id=517
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '357.5', '357.5', '2026-09-20', '1', '0', '0', '2026-09-20 11:21:43','إضافة منتج علبه فيشر 6 ملي الكمية 65','1','0','0','0','419','productController.php?do=edit&id=419'); -- id=644
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('644', '382', '357.5', '','0'); -- id=644
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2103049.61', 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 ('644', '121', '357.5', '','0'); -- id=644
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1152377.37', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'علبه فيشر 6 ملي', productDescription = '', productCatId = '6', productBuyPrice = '5.50', productSellAllPrice = '7.00', productSellUnitPrice = '8.00', productSellHalfPrice = '7.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00419',type ='0', expireDate = '0' , dailyentryId = '644',isService = '0',isOptic = '0',lastbuyprice = '5.5',lastbuyprice_withDiscount = '5.5',meanbuyprice = '5.5',meanbuyprice_withDiscount = '5.5' , productbuypricereal = '5.5' , buypricereal_precentage = '0' , buytotal_precentage = '27.27' , buyhalf_precentage = '27.27' , buypart_precentage = '45.45',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='5.5',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='5.5',meanbuyprice_withTax='5.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='5.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '419';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:51:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:21:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:21:45', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1695
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:55:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:25:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:25:40', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1696
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 ملي fit','','6','20','25','25','25','2026-09-20','0','1','0','','0','0','0','0','0','20','20','20','20','20','0','25','25','25','.','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=420
UPDATE product SET productName = 'بنطه 6 ملي fit', productDescription = '', productCatId = '6', productBuyPrice = '20', productSellAllPrice = '25', productSellUnitPrice = '25', productSellHalfPrice = '25', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00420',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 = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',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 = '420';
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', '420', '1.00', '2026-09-20', '1', '0','0042001','25','25','25','20','','0','0','0','0','0','0','0','0','0','0'); -- id=420
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('420', '1', '13', '1', '2026-09-20'); -- id=420
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('420', '1', '13', '0', '420', 'إضافة منتج', 'productController.php', '0', '13', '1', '2026-09-20','0','0'); -- id=1105
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (420, 1,'2026-09-20 11:25:41',1)
                ON DUPLICATE KEY UPDATE productid = 420, edited = 1, sysdate = '2026-09-20 11:25:41', userid = 1; -- id=518
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '260', '260', '2026-09-20', '1', '0', '0', '2026-09-20 11:25:41','إضافة منتج بنطه 6 ملي fit الكمية 13','1','0','0','0','420','productController.php?do=edit&id=420'); -- id=645
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('645', '382', '260', '','0'); -- id=645
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2103309.61', 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 ('645', '121', '260', '','0'); -- id=645
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1152637.37', 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 ملي fit', productDescription = '', productCatId = '6', productBuyPrice = '20.00', productSellAllPrice = '25.00', productSellUnitPrice = '25.00', productSellHalfPrice = '25.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00420',type ='0', expireDate = '0' , dailyentryId = '645',isService = '0',isOptic = '0',lastbuyprice = '20',lastbuyprice_withDiscount = '20',meanbuyprice = '20',meanbuyprice_withDiscount = '20' , productbuypricereal = '20' , buypricereal_precentage = '0' , buytotal_precentage = '25' , buyhalf_precentage = '25' , buypart_precentage = '25',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 = '420';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:55:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:25:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:25:44', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1697
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:57:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:27:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-09-20 11:27:36', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientController.php'); -- id=1698
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:58:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:28:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-09-20 11:28:49', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientController.php?do=add'); -- id=1699
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 ('وائل راضي' , '', '', '', '3550', '', '0', '2026-09-20 11:28:49', '1', '0','17','0','','-10','17','10000',',','-1','0','','0','0','.','2026-09-20','0','17','','0','0','0','','','0','0','','','','','','','','','','-1','','.','.','0','','','0','0',''); -- id=17
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('17', '0', '0', '', ''); -- id=17
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 ('17','0','3550','0','إضافة عميل جديد','17', '3550', '2026-09-20 11:28:49', '1', 'clientController.php', '', '3550', '0', null, '0', null, null,'', '0','1','1','3550','1','','0','0','',''); -- id=105
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-20 11:28:50'); -- id=445
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3550', '3550', '2026-09-20', '1', '0', '0', '2026-09-20 11:28:50','تم اضافة عميل وائل راضي','1','0','0','0','17','clientController.php?do=edit&id=17'); -- id=646
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('646', '445', '3550', '','0'); -- id=646
UPDATE accountstree SET name = 'وائل راضي', customName = 'وائل راضي', customNameEn = 'وائل راضي', nameEn = 'وائل راضي', parent = '58', accountNature = '0', theValue = '3550', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 11:28:50' WHERE id = '445';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('646', '121', '3550', '','0'); -- id=646
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1156187.37', 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 = '3550.00', clientdetails = '', conditions = '0', clientdate = '2026-09-20', userid = '1'  , clientareaid = '0'  ,clientcode = '17',dailyentryid = '646' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '17' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='17' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='445',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 = '17';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:58:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:28:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2026-09-20 11:28:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientController.php'); -- id=1700
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:58:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:28:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:28:54', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1701
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:59:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:29:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:29:24', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1702

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafa756caf04
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(17,@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-20 11:29:25', '06aafa756caf04', '17', '3550.00', '3578', '0', '1', '28.00', '28', '0', '28', '1', '2026-09-20 11:29:25', '', '1', '0', 'وائل راضي', '1', '1', '3', '0', '17 - وائل راضي', '1' ,'0','','','','','-1','0','0','0','0','0','28','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=66
UPDATE client SET  clientdebt = '3578', userid = '1' WHERE clientid = '17';
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 ('17','3550.00','28','0','اضافة فاتورة مبيعات','66', '3578', '2026-09-20 11:29:25', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '28', '0', null, '0', null, null,'', '0','1','1','28','1','2026-09-20 11:29:25','0','0','',''); -- id=106
UPDATE client SET  inUse = 0 where clientid = 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 ('26','00395', '66', '12', '395', '1', '28', '28', '0', '', '1', '2026-09-20 11:29:26', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','28','28','0','','0','0.00','0','0','0','0'); -- id=433
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 433;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-09-20', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2026-09-20 11:29:26' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '1', '1', '66', 'اضافة فاتورة مبيعات', 'sellbillController.php', '43', '42', '1', '2026-09-20 11:29:26','0','0'); -- id=1106
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '28', '28', '2026-09-20', '1', '0', '0', '2026-09-20 11:29:26','اضافة فاتورة مبيعات رقم 66','1','0',null,'0','66','sellbillController.php?do=showDetail&sellbillid=66'); -- id=647
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('647', '445', '28', '','0'); -- id=647
UPDATE accountstree SET name = 'وائل راضي', customName = 'وائل راضي', customNameEn = 'وائل راضي', nameEn = 'وائل راضي', parent = '58', accountNature = '0', theValue = '3578', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 11:28:50' WHERE id = '445';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('647', '143', '28', '','0'); -- id=647
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '198402.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '26', '26', '2026-09-20', '1', '0', '0', '2026-09-20 11:29:26','اضافة فاتورة مبيعات رقم 66 - صرف البضاعة من المخزن','1','0',null,'0','66','sellbillController.php?do=showDetail&sellbillid=66'); -- id=648
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('648', '402', '26', '','0'); -- id=648
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '187210.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('648', '382', '26', '','0'); -- id=648
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2103283.61', 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='647,0,648' where sellbillid=66;
 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-20', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (17, '2026-09-20', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 28, 26, 26
                    , 26, 26, 26, 26, 26, 26)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+28, netSellCostBuyPrice = netSellCostBuyPrice+26
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+26
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+26
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+26
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+26
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+26
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+26
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+26;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafa756caf04 and sellbillId = 66 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:59:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:29:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:29:27', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1703
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:59:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:29:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:29:34', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1704
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:59:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:29:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:29:43', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1705
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 07:59:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:29:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:29:51', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=61'); -- id=1706
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:01:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:31:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 11:31:41', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=1707
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:01:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:31:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 11:31:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1708
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:01:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:31:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:31:58', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1709
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:02:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:32:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:32:27', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1710
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','75','90','90','90','2026-09-20','0','1','0','','0','0','0','0','0','75','75','75','75','75','0','20','20','20','.','0','0','0','75','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','75','75','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','75','0','0','0','0','0','0','','','0','0','0','0'); -- id=421
UPDATE product SET productName = 'جلوب عين بقره كبير ', productDescription = '', productCatId = '6', productBuyPrice = '75', productSellAllPrice = '90', productSellUnitPrice = '90', productSellHalfPrice = '90', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00421',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '75',lastbuyprice_withDiscount = '75',meanbuyprice = '75',meanbuyprice_withDiscount = '75' , productbuypricereal = '75' , buypricereal_precentage = '0' , buytotal_precentage = '20' , buyhalf_precentage = '20' , buypart_precentage = '20',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='75',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='75',meanbuyprice_withTax='75',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='75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '421';
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', '421', '1.00', '2026-09-20', '1', '0','0042101','90','90','90','75','','0','0','0','0','0','0','0','0','0','0'); -- id=421
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('421', '1', '20', '1', '2026-09-20'); -- id=421
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('421', '1', '20', '0', '421', 'إضافة منتج', 'productController.php', '0', '20', '1', '2026-09-20','0','0'); -- id=1107
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (421, 1,'2026-09-20 11:32:28',1)
                ON DUPLICATE KEY UPDATE productid = 421, edited = 1, sysdate = '2026-09-20 11:32:28', userid = 1; -- id=519
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1500', '1500', '2026-09-20', '1', '0', '0', '2026-09-20 11:32:28','إضافة منتج جلوب عين بقره كبير  الكمية 20','1','0','0','0','421','productController.php?do=edit&id=421'); -- id=649
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('649', '382', '1500', '','0'); -- id=649
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2104783.61', 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 ('649', '121', '1500', '','0'); -- id=649
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1157687.37', 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 = '75.00', productSellAllPrice = '90.00', productSellUnitPrice = '90.00', productSellHalfPrice = '90.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00421',type ='0', expireDate = '0' , dailyentryId = '649',isService = '0',isOptic = '0',lastbuyprice = '75',lastbuyprice_withDiscount = '75',meanbuyprice = '75',meanbuyprice_withDiscount = '75' , productbuypricereal = '75' , buypricereal_precentage = '0' , buytotal_precentage = '20' , buyhalf_precentage = '20' , buypart_precentage = '20',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='75',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='75',meanbuyprice_withTax='75',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='75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '421';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:02:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:32:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:32:31', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1711
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:02:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:32:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 11:32:39', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1712
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:02:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:32:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:32:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1713
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:03:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:33:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:33:41', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1714
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('وش رصاصي ','','3','15','15.75','15.75','15.75','2026-09-20','0','1','0','','0','0','0','0','0','15','15','15','15','15','0','5','5','5','.','0','0','0','15','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','15','15','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','15','0','0','0','0','0','0','','','0','0','0','0'); -- id=422
UPDATE product SET productName = 'وش رصاصي ', productDescription = '', productCatId = '3', productBuyPrice = '15', productSellAllPrice = '15.75', productSellUnitPrice = '15.75', productSellHalfPrice = '15.75', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00422',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '15',lastbuyprice_withDiscount = '15',meanbuyprice = '15',meanbuyprice_withDiscount = '15' , productbuypricereal = '15' , buypricereal_precentage = '0' , buytotal_precentage = '5' , buyhalf_precentage = '5' , buypart_precentage = '5',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='15',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='15',meanbuyprice_withTax='15',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='15',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '422';
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', '422', '1.00', '2026-09-20', '1', '0','0042201','15.75','15.75','15.75','15','','0','0','0','0','0','0','0','0','0','0'); -- id=422
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('422', '1', '80', '1', '2026-09-20'); -- id=422
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('422', '1', '80', '0', '422', 'إضافة منتج', 'productController.php', '0', '80', '1', '2026-09-20','0','0'); -- id=1108
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (422, 1,'2026-09-20 11:33:43',1)
                ON DUPLICATE KEY UPDATE productid = 422, edited = 1, sysdate = '2026-09-20 11:33:43', userid = 1; -- id=520
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1200', '1200', '2026-09-20', '1', '0', '0', '2026-09-20 11:33:43','إضافة منتج وش رصاصي  الكمية 80','1','0','0','0','422','productController.php?do=edit&id=422'); -- id=650
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('650', '382', '1200', '','0'); -- id=650
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2105983.61', 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 ('650', '121', '1200', '','0'); -- id=650
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1158887.37', 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 = '3', productBuyPrice = '15.00', productSellAllPrice = '15.75', productSellUnitPrice = '15.75', productSellHalfPrice = '15.75', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00422',type ='0', expireDate = '0' , dailyentryId = '650',isService = '0',isOptic = '0',lastbuyprice = '15',lastbuyprice_withDiscount = '15',meanbuyprice = '15',meanbuyprice_withDiscount = '15' , productbuypricereal = '15' , buypricereal_precentage = '0' , buytotal_precentage = '5' , buyhalf_precentage = '5' , buypart_precentage = '5',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='15',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='15',meanbuyprice_withTax='15',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='15',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '422';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:03:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 11:33:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 11:33:45', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1715
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:49:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:19:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 12:19:27', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1716

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafa8386d4c8
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(3,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-20 12:19:28', '06aafa8386d4c8', '3', '3895.00', '6835', '0', '1', '2940.00', '2940', '0', '2940', '1', '2026-09-20 12:19:28', '', '1', '0', 'عبدالحي الشاذلي ', '1', '1', '3', '0', '3 - عبدالحي الشاذلي ', '96' ,'0','','','','','-1','0','0','0','0','0','2940','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=67
UPDATE client SET  clientdebt = '6835', userid = '1' WHERE clientid = '3';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('3','3895.00','2940','0','اضافة فاتورة مبيعات','67', '6835', '2026-09-20 12:19:28', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2940', '0', null, '0', null, null,'', '0','1','1','2940','1','2026-09-20 12:19:28','0','0','',''); -- id=107
UPDATE client SET  inUse = 0 where clientid = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00422', '67', '3', '422', '60', '15.75', '945', '0', '', '1', '2026-09-20 12:19:28', '422', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15.75','945','0','','0','0.00','0','0','0','0'); -- id=434
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 434;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (422, '2026-09-20', 945, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+945, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+60
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 945, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+945, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-20 12:19:29' WHERE storedetailid = '422';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('422', '1', '60', '1', '67', 'اضافة فاتورة مبيعات', 'sellbillController.php', '80', '20', '1', '2026-09-20 12:19:29','0','0'); -- id=1109
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('75','00421', '67', '6', '421', '6', '90', '540', '0', '', '1', '2026-09-20 12:19:29', '421', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','90','540','0','','0','0.00','0','0','0','0'); -- id=435
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 435;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (421, '2026-09-20', 540, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 540, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2026-09-20 12:19:29' WHERE storedetailid = '421';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('421', '1', '6', '1', '67', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '14', '1', '2026-09-20 12:19:29','0','0'); -- id=1110
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('78.75','00141', '67', '21', '141', '10', '80', '800', '0', '', '1', '2026-09-20 12:19:29', '141', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','80','800','0','','0','0.00','0','0','0','0'); -- id=436
UPDATE sellbilldetail SET  lastbuyprice = 78.75 , meanbuyprice = 78.75, lastbuyprice_withDiscount = 78.75, meanbuyprice_withDiscount = 78.75
        , lastbuyprice_withTax = 78.75, meanbuyprice_withTax = 78.75, lastbuyprice_withDiscountAndTax = 78.75
                where sellbilldetailid = 436;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (141, '2026-09-20', 800, 787.5, 787.5
                    , 787.5, 787.5, 787.5, 787.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 787.5, 787.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+787.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+787.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+787.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+787.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+787.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+787.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+787.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+787.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+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-20', 800, 787.5, 787.5
                    , 787.5, 787.5, 787.5, 787.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 787.5, 787.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+787.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+787.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+787.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+787.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+787.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+787.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+787.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+787.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 = '22', userid = '1', storedetaildate = '2026-09-20 12:19:29' WHERE storedetailid = '141';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('141', '1', '10', '1', '67', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '22', '1', '2026-09-20 12:19:29','0','0'); -- id=1111
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.73','00090', '67', '18', '90', '5', '9.5', '47.5', '0', '', '1', '2026-09-20 12:19:29', '90', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','3-5,','1','1','0','0','9.5','47.5','0','','0','0.00','0','0','0','0'); -- id=437
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 437;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (90, '2026-09-20', 47.5, 43.65, 43.65
                    , 43.65, 43.65, 43.65, 43.65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 43.65, 43.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+43.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+43.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+43.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+43.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+43.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+43.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+43.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+43.65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 47.5, 43.65, 43.65
                    , 43.65, 43.65, 43.65, 43.65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 43.65, 43.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+43.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+43.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+43.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+43.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+43.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+43.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+43.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+43.65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-20 12:19:30' WHERE storedetailid = '90';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '1', '5', '1', '67', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '45', '1', '2026-09-20 12:19:30','0','0'); -- id=1112
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.85','00096', '67', '18', '96', '5', '5.5', '27.5', '0', '', '1', '2026-09-20 12:19:30', '96', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','5.5','27.5','0','','0','0.00','0','0','0','0'); -- id=438
UPDATE sellbilldetail SET  lastbuyprice = 4.85 , meanbuyprice = 4.85, lastbuyprice_withDiscount = 4.85, meanbuyprice_withDiscount = 4.85
        , lastbuyprice_withTax = 4.85, meanbuyprice_withTax = 4.85, lastbuyprice_withDiscountAndTax = 4.85
                where sellbilldetailid = 438;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (96, '2026-09-20', 27.5, 24.25, 24.25
                    , 24.25, 24.25, 24.25, 24.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 24.25, 24.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27.5, sellCostBuyPrice =sellCostBuyPrice+24.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 27.5, 24.25, 24.25
                    , 24.25, 24.25, 24.25, 24.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24.25, 24.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27.5, sellCostBuyPrice =sellCostBuyPrice+24.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-5', userid = '1', storedetaildate = '2026-09-20 12:19:30' WHERE storedetailid = '96';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('96', '1', '5', '1', '67', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-5', '1', '2026-09-20 12:19:30','0','0'); -- id=1113
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('55.5','00177', '67', '19', '177', '10', '58', '580', '0', '', '1', '2026-09-20 12:19:30', '177', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','58','580','0','','0','0.00','0','0','0','0'); -- id=439
UPDATE sellbilldetail SET  lastbuyprice = 55.50 , meanbuyprice = 55.50, lastbuyprice_withDiscount = 55.50, meanbuyprice_withDiscount = 55.50
        , lastbuyprice_withTax = 55.5, meanbuyprice_withTax = 55.5, lastbuyprice_withDiscountAndTax = 55.5
                where sellbilldetailid = 439;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (177, '2026-09-20', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+555
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+555
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 12:19:30' WHERE storedetailid = '177';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('177', '1', '10', '1', '67', 'اضافة فاتورة مبيعات', 'sellbillController.php', '131', '121', '1', '2026-09-20 12:19:30','0','0'); -- id=1114
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2940', '2940', '2026-09-20', '1', '0', '0', '2026-09-20 12:19:31','اضافة فاتورة مبيعات رقم 67','1','0',null,'0','67','sellbillController.php?do=showDetail&sellbillid=67'); -- id=651
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('651', '427', '2940', '','0'); -- id=651
UPDATE accountstree SET name = 'عبدالحي الشاذلي ', customName = 'عبدالحي الشاذلي ', customNameEn = 'عبدالحي الشاذلي ', nameEn = 'عبدالحي الشاذلي ', parent = '58', accountNature = '0', theValue = '6835', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-14 13:19:31' WHERE id = '427';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('651', '143', '2940', '','0'); -- id=651
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '201342.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2760.4', '2760.4', '2026-09-20', '1', '0', '0', '2026-09-20 12:19:31','اضافة فاتورة مبيعات رقم 67 - صرف البضاعة من المخزن','1','0',null,'0','67','sellbillController.php?do=showDetail&sellbillid=67'); -- id=652
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('652', '402', '2760.4', '','0'); -- id=652
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '189970.86', 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 ('652', '382', '2760.4', '','0'); -- id=652
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2103223.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='651,0,652' where sellbillid=67;
 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-20', 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2760.4, 2760.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2760.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-09-20', 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2760.4, 2760.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2760.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4, 2760.4, 2760.4)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2940, netSellCostBuyPrice = netSellCostBuyPrice+2760.4
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2760.4
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2760.4
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2760.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2760.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2760.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2760.4
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2760.4;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafa8386d4c8 and sellbillId = 67 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 08:49:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:19:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 12:19:32', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1717
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:15:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:45:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 12:45:23', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1718
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:16:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:46:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:46:21', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1719
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:19:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:49:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:49:50', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1720
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 ('نجفه موديل k11 ثلاثي اسمر ','','16','1600','1750','1980','1750','2026-09-20','0','1','0','','0','0','0','0','0','1600','1600','1600','1600','1600','0','9.38','9.38','23.75','.','0','0','0','1600','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','1600','1600','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','1600','0','0','0','0','0','0','','','0','0','0','0'); -- id=423
UPDATE product SET productName = 'نجفه موديل k11 ثلاثي اسمر ', productDescription = '', productCatId = '16', productBuyPrice = '1600', productSellAllPrice = '1750', productSellUnitPrice = '1980', productSellHalfPrice = '1750', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00423',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1600',lastbuyprice_withDiscount = '1600',meanbuyprice = '1600',meanbuyprice_withDiscount = '1600' , productbuypricereal = '1600' , buypricereal_precentage = '0' , buytotal_precentage = '9.38' , buyhalf_precentage = '9.38' , buypart_precentage = '23.75',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1600',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='1600',meanbuyprice_withTax='1600',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='1600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '423';
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', '423', '1.00', '2026-09-20', '1', '0','0042301','1750','1750','1980','1600','','0','0','0','0','0','0','0','0','0','0'); -- id=423
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('423', '1', '5', '1', '2026-09-20'); -- id=423
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('423', '1', '5', '0', '423', 'إضافة منتج', 'productController.php', '0', '5', '1', '2026-09-20','0','0'); -- id=1115
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (423, 1,'2026-09-20 12:49:51',1)
                ON DUPLICATE KEY UPDATE productid = 423, edited = 1, sysdate = '2026-09-20 12:49:51', userid = 1; -- id=521
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8000', '8000', '2026-09-20', '1', '0', '0', '2026-09-20 12:49:51','إضافة منتج نجفه موديل k11 ثلاثي اسمر  الكمية 5','1','0','0','0','423','productController.php?do=edit&id=423'); -- id=653
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('653', '382', '8000', '','0'); -- id=653
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2111223.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('653', '121', '8000', '','0'); -- id=653
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1166887.37', 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 = 'نجفه موديل k11 ثلاثي اسمر ', productDescription = '', productCatId = '16', productBuyPrice = '1600.00', productSellAllPrice = '1750.00', productSellUnitPrice = '1980.00', productSellHalfPrice = '1750.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00423',type ='0', expireDate = '0' , dailyentryId = '653',isService = '0',isOptic = '0',lastbuyprice = '1600',lastbuyprice_withDiscount = '1600',meanbuyprice = '1600',meanbuyprice_withDiscount = '1600' , productbuypricereal = '1600' , buypricereal_precentage = '0' , buytotal_precentage = '9.38' , buyhalf_precentage = '9.38' , buypart_precentage = '23.75',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1600',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='1600',meanbuyprice_withTax='1600',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='1600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '423';
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 ('نجفه موديل k28 ثلاثي اسمر ','','16','1600','1750','1950','1750','2026-09-20','0','1','0','','0','0','0','0','0','1600','1600','1600','1600','1600','0','9.38','9.38','21.88','.','0','0','0','1600','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','1600','1600','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','1600','0','0','0','0','0','0','','','0','0','0','0'); -- id=424
UPDATE product SET productName = 'نجفه موديل k28 ثلاثي اسمر ', productDescription = '', productCatId = '16', productBuyPrice = '1600', productSellAllPrice = '1750', productSellUnitPrice = '1950', productSellHalfPrice = '1750', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00424',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1600',lastbuyprice_withDiscount = '1600',meanbuyprice = '1600',meanbuyprice_withDiscount = '1600' , productbuypricereal = '1600' , buypricereal_precentage = '0' , buytotal_precentage = '9.38' , buyhalf_precentage = '9.38' , buypart_precentage = '21.88',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1600',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='1600',meanbuyprice_withTax='1600',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='1600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '424';
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', '424', '1.00', '2026-09-20', '1', '0','0042401','1750','1750','1950','1600','','0','0','0','0','0','0','0','0','0','0'); -- id=424
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('424', '1', '5', '1', '2026-09-20'); -- id=424
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('424', '1', '5', '0', '424', 'إضافة منتج', 'productController.php', '0', '5', '1', '2026-09-20','0','0'); -- id=1116
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (424, 1,'2026-09-20 12:49:53',1)
                ON DUPLICATE KEY UPDATE productid = 424, edited = 1, sysdate = '2026-09-20 12:49:53', userid = 1; -- id=522
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8000', '8000', '2026-09-20', '1', '0', '0', '2026-09-20 12:49:53','إضافة منتج نجفه موديل k28 ثلاثي اسمر  الكمية 5','1','0','0','0','424','productController.php?do=edit&id=424'); -- id=654
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('654', '382', '8000', '','0'); -- id=654
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2119223.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('654', '121', '8000', '','0'); -- id=654
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1174887.37', 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 = 'نجفه موديل k28 ثلاثي اسمر ', productDescription = '', productCatId = '16', productBuyPrice = '1600.00', productSellAllPrice = '1750.00', productSellUnitPrice = '1950.00', productSellHalfPrice = '1750.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00424',type ='0', expireDate = '0' , dailyentryId = '654',isService = '0',isOptic = '0',lastbuyprice = '1600',lastbuyprice_withDiscount = '1600',meanbuyprice = '1600',meanbuyprice_withDiscount = '1600' , productbuypricereal = '1600' , buypricereal_precentage = '0' , buytotal_precentage = '9.38' , buyhalf_precentage = '9.38' , buypart_precentage = '21.88',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1600',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='1600',meanbuyprice_withTax='1600',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='1600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '424';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:19:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:49:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:49:56', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1721
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:23:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:53:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:53:57', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1722
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 ('دلايه ليد موديل 851 دهبي','','16','450','550','595','550','2026-09-20','0','1','0','','0','0','0','0','0','450','450','450','450','450','0','22.22','22.22','32.22','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=425
UPDATE product SET productName = 'دلايه ليد موديل 851 دهبي', productDescription = '', productCatId = '16', productBuyPrice = '450', productSellAllPrice = '550', productSellUnitPrice = '595', productSellHalfPrice = '550', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00425',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '22.22' , buyhalf_precentage = '22.22' , buypart_precentage = '32.22',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '425';
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', '425', '1.00', '2026-09-20', '1', '0','0042501','550','550','595','450','','0','0','0','0','0','0','0','0','0','0'); -- id=425
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('425', '1', '4', '1', '2026-09-20'); -- id=425
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('425', '1', '4', '0', '425', 'إضافة منتج', 'productController.php', '0', '4', '1', '2026-09-20','0','0'); -- id=1117
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (425, 1,'2026-09-20 12:53:58',1)
                ON DUPLICATE KEY UPDATE productid = 425, edited = 1, sysdate = '2026-09-20 12:53:58', userid = 1; -- id=523
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1800', '1800', '2026-09-20', '1', '0', '0', '2026-09-20 12:53:58','إضافة منتج دلايه ليد موديل 851 دهبي الكمية 4','1','0','0','0','425','productController.php?do=edit&id=425'); -- id=655
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('655', '382', '1800', '','0'); -- id=655
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2121023.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('655', '121', '1800', '','0'); -- id=655
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1176687.37', 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 = 'دلايه ليد موديل 851 دهبي', productDescription = '', productCatId = '16', productBuyPrice = '450.00', productSellAllPrice = '550.00', productSellUnitPrice = '595.00', productSellHalfPrice = '550.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00425',type ='0', expireDate = '0' , dailyentryId = '655',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '22.22' , buyhalf_precentage = '22.22' , buypart_precentage = '32.22',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',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='450',meanbuyprice_withTax='450',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='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '425';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:24:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:54:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:54:01', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1723
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:24:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:54:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-20 12:54:02', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=1724
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:24:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:54:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-20 12:54:39', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=1725
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-20' WHERE storedetailid = '423';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('423', '1', '2', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '5', '3', '1', '2026-09-20','0','0'); -- id=1118
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3200', '3200', '2026-09-20', '1', '0', '0', '2026-09-20 12:54:39','اعادة جرد للمنتج : (نجفه موديل k11 ثلاثي اسمر /نجف) فى مخزن : (المخزن الرئيسي) بالكمية : 3','1','0',null,'0','1118','inventoryController.php?do=details&id=1118'); -- id=656
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('656', '188', '3200', '','0'); -- id=656
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-47378.75', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('656', '382', '3200', '','0'); -- id=656
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2117823.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:24:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:54:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-20 12:54:43', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=1726
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-09-20' WHERE storedetailid = '424';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('424', '1', '2', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '5', '7', '1', '2026-09-20','0','0'); -- id=1119
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3200', '3200', '2026-09-20', '1', '0', '0', '2026-09-20 12:54:44','اعادة جرد للمنتج : (نجفه موديل k28 ثلاثي اسمر /نجف) فى مخزن : (المخزن الرئيسي) بالكمية : 7','1','0',null,'0','1119','inventoryController.php?do=details&id=1119'); -- id=657
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('657', '382', '3200', '','0'); -- id=657
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2121023.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('657', '188', '3200', '','0'); -- id=657
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-50578.75', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:24:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:54:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 12:54:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1727
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:26:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:56:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:56:15', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1728
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:27:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:57:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:57:10', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1729
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:27:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:57:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:57:19', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1730
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '150', '150', '2026-09-20', '1', '0', '0', '2026-09-20 12:57:28','تعديل منتج (نجفه موديل k11 ثلاثي اسمر ) السعر من (1600.00) الى (1650) و الكميه (3)','1','0',null,'0','423','productController.php?do=edit&id=423'); -- id=658
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('658', '382', '150', '','0'); -- id=658
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2121173.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('658', '53', '150', '','0'); -- id=658
UPDATE accountstree SET name = 'فروقات اعاده تقييم بضاعه', customName = 'فروقات اعاده تقييم بضاعه', customNameEn = '', nameEn = '', parent = '147', accountNature = '1', theValue = '548.75', theOrder = '0', layingOrder = '4201', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '2', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2024-05-07 12:08:31' WHERE id = '53';
COMMIT;
UPDATE productunit SET proUnitBuyPrice  = 1650 * productnumber WHERE productid = 423;
UPDATE product SET productName = 'نجفه موديل k11 ثلاثي اسمر ', productDescription = '', productCatId = '16', productBuyPrice = '1650', productSellAllPrice = '1750.00', productSellUnitPrice = '1980.00', productSellHalfPrice = '1750.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00423',type ='0', expireDate = '0' , dailyentryId = '653',isService = '0',isOptic = '0',lastbuyprice = '1600.00',lastbuyprice_withDiscount = '1600',meanbuyprice = '1625',meanbuyprice_withDiscount = '1625' , productbuypricereal = '1600.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.38' , buyhalf_precentage = '9.38' , buypart_precentage = '23.75',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1600',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='1625',meanbuyprice_withTax='1625',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='1600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '423';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (423, 1,'2026-09-20 12:57:29',1)
                ON DUPLICATE KEY UPDATE productid = 423, edited = 1, sysdate = '2026-09-20 12:57:29', userid = 1; -- id=521
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:27:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:57:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 12:57:40', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1731
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:29:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:59:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 12:59:16', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1732

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafbb7e5c187
-- ----------------------------------------------------------------------------------------------------

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-20 12:59:17', '06aafbb7e5c187', '1', '0.00', '0', '0', '1', '6675.00', '6675', '6675', '0', '1', '2026-09-20 12:59:17', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','6675','0','','0','0','6675','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=68
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','اضافة فاتورة مبيعات','68', '0', '2026-09-20 12:59:17', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6675', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 12:59:17','0','0','',''); -- id=108
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1600','00424', '68', '16', '424', '1', '1950', '1950', '0', '', '1', '2026-09-20 12:59:18', '424', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1950','1950','0','','0','0.00','0','0','0','0'); -- id=440
UPDATE sellbilldetail SET  lastbuyprice = 1600.00 , meanbuyprice = 1600.00, lastbuyprice_withDiscount = 1600.00, meanbuyprice_withDiscount = 1600.00
        , lastbuyprice_withTax = 1600, meanbuyprice_withTax = 1600, lastbuyprice_withDiscountAndTax = 1600
                where sellbilldetailid = 440;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (424, '2026-09-20', 1950, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1950, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1950, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1950, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 12:59:18' WHERE storedetailid = '424';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('424', '1', '1', '1', '68', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7', '6', '1', '2026-09-20 12:59:18','0','0'); -- id=1120
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1650','00423', '68', '16', '423', '1', '1980', '1980', '0', '', '1', '2026-09-20 12:59:18', '423', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1980','1980','0','','0','0.00','0','0','0','0'); -- id=441
UPDATE sellbilldetail SET  lastbuyprice = 1600.00 , meanbuyprice = 1625.00, lastbuyprice_withDiscount = 1600.00, meanbuyprice_withDiscount = 1625.00
        , lastbuyprice_withTax = 1625, meanbuyprice_withTax = 1625, lastbuyprice_withDiscountAndTax = 1600
                where sellbilldetailid = 441;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (423, '2026-09-20', 1980, 1650, 1600
                    , 1625, 1600, 1625, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1625, 1625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1980, 1650, 1600
                    , 1625, 1600, 1625, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1625, 1625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1625
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1625
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1625
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-20 12:59:18' WHERE storedetailid = '423';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('423', '1', '1', '1', '68', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-09-20 12:59:18','0','0'); -- id=1121
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1800','00381', '68', '16', '381', '1', '2150', '2150', '0', '', '1', '2026-09-20 12:59:18', '381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2150','2150','0','','0','0.00','0','0','0','0'); -- id=442
UPDATE sellbilldetail SET  lastbuyprice = 1800.00 , meanbuyprice = 1800.00, lastbuyprice_withDiscount = 1800.00, meanbuyprice_withDiscount = 1800.00
        , lastbuyprice_withTax = 1800, meanbuyprice_withTax = 1800, lastbuyprice_withDiscountAndTax = 1800
                where sellbilldetailid = 442;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (381, '2026-09-20', 2150, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2150, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 2150, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2150, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 12:59:19' WHERE storedetailid = '381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('381', '1', '1', '1', '68', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '4', '1', '2026-09-20 12:59:19','0','0'); -- id=1122
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','00425', '68', '16', '425', '1', '595', '595', '0', '', '1', '2026-09-20 12:59:19', '425', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','595','595','0','','0','0.00','0','0','0','0'); -- id=443
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 443;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (425, '2026-09-20', 595, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+595, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 595, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+595, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 12:59:19' WHERE storedetailid = '425';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('425', '1', '1', '1', '68', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '3', '1', '2026-09-20 12:59:19','0','0'); -- id=1123
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-190399.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-197074.984375','6675', '0', '1', 'اضافة فاتورة مبيعات', '68', '-190399.984375', '2026-09-20 12:59:19', '1',  'sellbillController.php','1','','0'); -- id=63
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6675', '6675', '2026-09-20', '1', '0', '0', '2026-09-20 12:59:19','اضافة فاتورة مبيعات رقم 68','1','0',null,'0','68','sellbillController.php?do=showDetail&sellbillid=68'); -- id=659
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('659', '383', '6675', '','0'); -- id=659
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-143707.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('659', '143', '6675', '','0'); -- id=659
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '208017.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5450', '5450', '2026-09-20', '1', '0', '0', '2026-09-20 12:59:19','اضافة فاتورة مبيعات رقم 68 - صرف البضاعة من المخزن','1','0',null,'0','68','sellbillController.php?do=showDetail&sellbillid=68'); -- id=660
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('660', '402', '5450', '','0'); -- id=660
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '195420.86', 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 ('660', '382', '5450', '','0'); -- id=660
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2115723.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='659,0,660' where sellbillid=68;
 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-20', 6675, 5500, 5450
                    , 5475, 5450, 5475, 5450
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5475, 5475, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6675, sellCostBuyPrice =sellCostBuyPrice+5500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5475
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5475
                        , returnSellVal = returnSellVal+0, 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-20', 6675, 5500, 5450
                    , 5475, 5450, 5475, 5450
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5475, 5475, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6675, sellCostBuyPrice =sellCostBuyPrice+5500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5475
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5475
                        , returnSellVal = returnSellVal+0, 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, 6675, 5500, 5450
                    , 5475, 5450, 5475, 5450, 5475, 5475)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6675, netSellCostBuyPrice = netSellCostBuyPrice+5500
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5450
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5475
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5450
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5475
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5450
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5475
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5475;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafbb7e5c187 and sellbillId = 68 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:29:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 12:59:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 12:59:21', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1733
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:41:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:11:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:11:41', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1734
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:48:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:18:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:18:28', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1735

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafbf6e6f2c9
-- ----------------------------------------------------------------------------------------------------

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-20 13:18:29', '06aafbf6e6f2c9', '1', '0.00', '0', '0', '1', '4455.00', '4455', '4455', '0', '1', '2026-09-20 13:18:29', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '19' ,'0','','','','','-1','0','0','0','0','0','4455','0','','0','0','4455','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=69
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','اضافة فاتورة مبيعات','69', '0', '2026-09-20 13:18:29', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4455', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 13:18:29','0','0','',''); -- id=109
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','00262', '69', '10', '262', '1', '620', '620', '0', '', '0', '2026-09-20 13:18:29', '262', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','620','620','0','','0','','0','0','0','0'); -- id=444
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 444;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (262, '2026-09-20', 620, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+620, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 620, 580, 580
                    , 580, 580, 580, 580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 580, 580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+620, sellCostBuyPrice =sellCostBuyPrice+580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-09-20 13:18:30' WHERE storedetailid = '262';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('262', '1', '1', '1', '69', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '4', '1', '2026-09-20 13:18:30','0','0'); -- id=1124
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1000','00229', '69', '10', '229', '2', '1130', '2260', '0', '', '0', '2026-09-20 13:18:30', '229', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','1130','2260','0','','0','','0','0','0','0'); -- id=445
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 445;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (229, '2026-09-20', 2260, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2260, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2260, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2260, 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 = '19', userid = '1', storedetaildate = '2026-09-20 13:18:30' WHERE storedetailid = '229';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '1', '2', '1', '69', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '19', '1', '2026-09-20 13:18:30','0','0'); -- id=1125
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 15;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('24.8','00291', '69', '24', '291', '5', '25.8', '129', '0', '', '0', '2026-09-20 13:18:30', '291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','15-5,','1','1','0','0','25.8','129','0','','0','','0','0','0','0'); -- id=446
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 = 446;
 INSERT INTO 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-20', 129, 124, 124
                    , 124, 124, 124, 124
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 124, 124, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+129, sellCostBuyPrice =sellCostBuyPrice+124
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+124, sellCostMeanBuyPrice = sellCostMeanBuyPrice+124
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+124, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+124
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+124
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+124
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+124
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 129, 124, 124
                    , 124, 124, 124, 124
                    , 0, 0, 0, 0
                    , 0, 0, 0, 124, 124, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+129, sellCostBuyPrice =sellCostBuyPrice+124
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+124, sellCostMeanBuyPrice = sellCostMeanBuyPrice+124
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+124, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+124
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+124
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+124
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+124
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 13:18:30' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '5', '1', '69', 'اضافة فاتورة مبيعات', 'sellbillController.php', '118', '113', '1', '2026-09-20 13:18:30','0','0'); -- id=1126
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.8','00292', '69', '24', '292', '5', '26.8', '134', '0', '', '0', '2026-09-20 13:18:30', '292', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','26.8','134','0','','0','','0','0','0','0'); -- id=447
UPDATE sellbilldetail SET  lastbuyprice = 25.80 , meanbuyprice = 25.80, lastbuyprice_withDiscount = 25.80, meanbuyprice_withDiscount = 25.80
        , lastbuyprice_withTax = 25.8, meanbuyprice_withTax = 25.8, lastbuyprice_withDiscountAndTax = 25.8
                where sellbilldetailid = 447;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (292, '2026-09-20', 134, 129, 129
                    , 129, 129, 129, 129
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 129, 129, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+134, sellCostBuyPrice =sellCostBuyPrice+129
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+129, sellCostMeanBuyPrice = sellCostMeanBuyPrice+129
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+129, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+129
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+129
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+129
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+129
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 134, 129, 129
                    , 129, 129, 129, 129
                    , 0, 0, 0, 0
                    , 0, 0, 0, 129, 129, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+134, sellCostBuyPrice =sellCostBuyPrice+129
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+129, sellCostMeanBuyPrice = sellCostMeanBuyPrice+129
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+129, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+129
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+129
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+129
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+129
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2026-09-20 13:18:31' WHERE storedetailid = '292';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('292', '1', '5', '1', '69', 'اضافة فاتورة مبيعات', 'sellbillController.php', '31', '26', '1', '2026-09-20 13:18:31','0','0'); -- id=1127
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('395','00263', '69', '10', '263', '1', '435', '435', '0', '', '0', '2026-09-20 13:18:31', '263', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','435','435','0','','0','0.00','0','0','0','0'); -- id=448
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 395.00, meanbuyprice_withDiscount = 395.00
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 395, lastbuyprice_withDiscountAndTax = 395
                where sellbilldetailid = 448;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (263, '2026-09-20', 435, 395, 395
                    , 395, 395, 395, 395
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 395, 395, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+435, sellCostBuyPrice =sellCostBuyPrice+395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+395, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+395
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+395
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+395
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 435, 395, 395
                    , 395, 395, 395, 395
                    , 0, 0, 0, 0
                    , 0, 0, 0, 395, 395, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+435, sellCostBuyPrice =sellCostBuyPrice+395
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+395, sellCostMeanBuyPrice = sellCostMeanBuyPrice+395
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+395, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+395
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+395
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+395
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+395
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-20 13:18:31' WHERE storedetailid = '263';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('263', '1', '1', '1', '69', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-09-20 13:18:31','0','0'); -- id=1128
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('132','00349', '69', '5', '349', '3', '149', '447', '0', '', '0', '2026-09-20 13:18:31', '349', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','149','447','0','','0','0.00','0','0','0','0'); -- id=449
UPDATE sellbilldetail SET  lastbuyprice = 132.00 , meanbuyprice = 132.00, lastbuyprice_withDiscount = 132.00, meanbuyprice_withDiscount = 132.00
        , lastbuyprice_withTax = 132, meanbuyprice_withTax = 132, lastbuyprice_withDiscountAndTax = 132
                where sellbilldetailid = 449;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (349, '2026-09-20', 447, 396, 396
                    , 396, 396, 396, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 396, 396, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+447, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+396
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+396
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+396
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 447, 396, 396
                    , 396, 396, 396, 396
                    , 0, 0, 0, 0
                    , 0, 0, 0, 396, 396, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+447, sellCostBuyPrice =sellCostBuyPrice+396
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+396, sellCostMeanBuyPrice = sellCostMeanBuyPrice+396
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+396, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+396
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+396
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+396
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+396
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 13:18:31' WHERE storedetailid = '349';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('349', '1', '3', '1', '69', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '1', '2026-09-20 13:18:31','0','0'); -- id=1129
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('206','00352', '69', '5', '352', '2', '215', '430', '0', '', '0', '2026-09-20 13:18:31', '352', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','215','430','0','','0','0.00','0','0','0','0'); -- id=450
UPDATE sellbilldetail SET  lastbuyprice = 206.00 , meanbuyprice = 206.00, lastbuyprice_withDiscount = 206.00, meanbuyprice_withDiscount = 206.00
        , lastbuyprice_withTax = 206, meanbuyprice_withTax = 206, lastbuyprice_withDiscountAndTax = 206
                where sellbilldetailid = 450;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (352, '2026-09-20', 430, 412, 412
                    , 412, 412, 412, 412
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 412, 412, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+430, sellCostBuyPrice =sellCostBuyPrice+412
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+412, sellCostMeanBuyPrice = sellCostMeanBuyPrice+412
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+412, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+412
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+412
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+412
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+412
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 430, 412, 412
                    , 412, 412, 412, 412
                    , 0, 0, 0, 0
                    , 0, 0, 0, 412, 412, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+430, sellCostBuyPrice =sellCostBuyPrice+412
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+412, sellCostMeanBuyPrice = sellCostMeanBuyPrice+412
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+412, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+412
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+412
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+412
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+412
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 13:18:32' WHERE storedetailid = '352';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('352', '1', '2', '1', '69', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '16', '1', '2026-09-20 13:18:32','0','0'); -- id=1130
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-185944.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-190399.984375','4455', '0', '1', 'اضافة فاتورة مبيعات', '69', '-185944.984375', '2026-09-20 13:18:32', '1',  'sellbillController.php','1','','0'); -- id=64
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4455', '4455', '2026-09-20', '1', '0', '0', '2026-09-20 13:18:32','اضافة فاتورة مبيعات رقم 69','1','0',null,'0','69','sellbillController.php?do=showDetail&sellbillid=69'); -- id=661
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('661', '383', '4455', '','0'); -- id=661
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-139252.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('661', '143', '4455', '','0'); -- id=661
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '212472.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4036', '4036', '2026-09-20', '1', '0', '0', '2026-09-20 13:18:32','اضافة فاتورة مبيعات رقم 69 - صرف البضاعة من المخزن','1','0',null,'0','69','sellbillController.php?do=showDetail&sellbillid=69'); -- id=662
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('662', '402', '4036', '','0'); -- id=662
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '199456.86', 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 ('662', '382', '4036', '','0'); -- id=662
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2111687.21', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='661,0,662' where sellbillid=69;
 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-20', 4455, 4036, 4036
                    , 4036, 4036, 4036, 4036
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4036, 4036, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4455, sellCostBuyPrice =sellCostBuyPrice+4036
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4036, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4036
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4036, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4036
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4036
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4036
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4036
                        , returnSellVal = returnSellVal+0, 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-20', 4455, 4036, 4036
                    , 4036, 4036, 4036, 4036
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4036, 4036, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4455, sellCostBuyPrice =sellCostBuyPrice+4036
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4036, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4036
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4036, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4036
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4036
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4036
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4036
                        , returnSellVal = returnSellVal+0, 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, 4455, 4036, 4036
                    , 4036, 4036, 4036, 4036, 4036, 4036)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4455, netSellCostBuyPrice = netSellCostBuyPrice+4036
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4036
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4036
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4036
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4036
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4036
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4036
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4036;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafbf6e6f2c9 and sellbillId = 69 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:48:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:18:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:18:34', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1736
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:54:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:24:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:24:09', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1737
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:54:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:24:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 13:24:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1738
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:55:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:25:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 13:25:01', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1739
UPDATE productunit SET proUnitSellAllPrice  = 11 * productnumber  WHERE productid = 165;
UPDATE product SET productName = 'لمبه 13 وات ايجي مسمار', productDescription = '', productCatId = '2', productBuyPrice = '8.75', productSellAllPrice = '11', productSellUnitPrice = '9.00', productSellHalfPrice = '9.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00165',type ='0', expireDate = '0' , dailyentryId = '183',isService = '0',isOptic = '0',lastbuyprice = '8.75',lastbuyprice_withDiscount = '8.75',meanbuyprice = '8.75',meanbuyprice_withDiscount = '8.75' , productbuypricereal = '8.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.86' , buyhalf_precentage = '2.86' , buypart_precentage = '2.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8.75',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='8.75',meanbuyprice_withTax='8.75',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.75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '165';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (165, 1,'2026-09-20 13:25:14',1)
                ON DUPLICATE KEY UPDATE productid = 165, edited = 1, sysdate = '2026-09-20 13:25:14', userid = 1; -- id=173
UPDATE productunit SET proUnitSellHalfPrice = 11 * productnumber WHERE productid = 165;
UPDATE product SET productName = 'لمبه 13 وات ايجي مسمار', productDescription = '', productCatId = '2', productBuyPrice = '8.75', productSellAllPrice = '11.00', productSellUnitPrice = '9.00', productSellHalfPrice = '11', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00165',type ='0', expireDate = '0' , dailyentryId = '183',isService = '0',isOptic = '0',lastbuyprice = '8.75',lastbuyprice_withDiscount = '8.75',meanbuyprice = '8.75',meanbuyprice_withDiscount = '8.75' , productbuypricereal = '8.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.86' , buyhalf_precentage = '2.86' , buypart_precentage = '2.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8.75',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='8.75',meanbuyprice_withTax='8.75',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.75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '165';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (165, 1,'2026-09-20 13:25:17',1)
                ON DUPLICATE KEY UPDATE productid = 165, edited = 1, sysdate = '2026-09-20 13:25:17', userid = 1; -- id=173
UPDATE productunit SET proUnitSellUnitPrice = 11 * productnumber WHERE productid = 165;
UPDATE product SET productName = 'لمبه 13 وات ايجي مسمار', productDescription = '', productCatId = '2', productBuyPrice = '8.75', productSellAllPrice = '11.00', productSellUnitPrice = '11', productSellHalfPrice = '11.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00165',type ='0', expireDate = '0' , dailyentryId = '183',isService = '0',isOptic = '0',lastbuyprice = '8.75',lastbuyprice_withDiscount = '8.75',meanbuyprice = '8.75',meanbuyprice_withDiscount = '8.75' , productbuypricereal = '8.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.86' , buyhalf_precentage = '2.86' , buypart_precentage = '2.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8.75',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='8.75',meanbuyprice_withTax='8.75',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.75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '165';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (165, 1,'2026-09-20 13:25:21',1)
                ON DUPLICATE KEY UPDATE productid = 165, edited = 1, sysdate = '2026-09-20 13:25:21', userid = 1; -- id=173
UPDATE productunit SET proUnitSellAllPrice  = 10 * productnumber  WHERE productid = 164;
UPDATE product SET productName = 'لمبه 13 وات ايجي قلاوظ سنه', productDescription = '', productCatId = '2', productBuyPrice = '8.75', productSellAllPrice = '10', productSellUnitPrice = '12.00', productSellHalfPrice = '9.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00164',type ='0', expireDate = '0' , dailyentryId = '182',isService = '0',isOptic = '0',lastbuyprice = '8.75',lastbuyprice_withDiscount = '8.75',meanbuyprice = '8.75',meanbuyprice_withDiscount = '8.75' , productbuypricereal = '8.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.86' , buyhalf_precentage = '2.86' , buypart_precentage = '37.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8.75',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='8.75',meanbuyprice_withTax='8.75',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='8.75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '164';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (164, 1,'2026-09-20 13:25:23',1)
                ON DUPLICATE KEY UPDATE productid = 164, edited = 1, sysdate = '2026-09-20 13:25:23', userid = 1; -- id=172
UPDATE productunit SET proUnitSellHalfPrice = 10 * productnumber WHERE productid = 164;
UPDATE product SET productName = 'لمبه 13 وات ايجي قلاوظ سنه', productDescription = '', productCatId = '2', productBuyPrice = '8.75', productSellAllPrice = '10.00', productSellUnitPrice = '12.00', productSellHalfPrice = '10', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00164',type ='0', expireDate = '0' , dailyentryId = '182',isService = '0',isOptic = '0',lastbuyprice = '8.75',lastbuyprice_withDiscount = '8.75',meanbuyprice = '8.75',meanbuyprice_withDiscount = '8.75' , productbuypricereal = '8.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.86' , buyhalf_precentage = '2.86' , buypart_precentage = '37.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8.75',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='8.75',meanbuyprice_withTax='8.75',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='8.75',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '164';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (164, 1,'2026-09-20 13:25:25',1)
                ON DUPLICATE KEY UPDATE productid = 164, edited = 1, sysdate = '2026-09-20 13:25:25', userid = 1; -- id=172
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:59:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:29:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:29:46', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1740

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafbc89e0690
-- ----------------------------------------------------------------------------------------------------

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-20 13:29:46', '06aafbc89e0690', '1', '0.00', '0', '0', '1', '2057.00', '2057', '2057', '0', '1', '2026-09-20 13:29:46', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '179' ,'0','','','','','-1','0','0','0','0','0','2057','0','','0','0','2057','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=70
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','اضافة فاتورة مبيعات','70', '0', '2026-09-20 13:29:47', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2057', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 13:29:46','0','0','',''); -- 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 ('7.27','00321', '70', '18', '321', '50', '7.9', '395', '0', '', '0', '2026-09-20 13:29:47', '321', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','7.9','395','0','','0','','0','0','0','0'); -- id=451
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.14, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.14
        , lastbuyprice_withTax = 7.14, meanbuyprice_withTax = 7.14, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 451;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (321, '2026-09-20', 395, 363.5, 350
                    , 357, 350, 357, 350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 357, 357, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+395, sellCostBuyPrice =sellCostBuyPrice+363.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+357
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+357
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+357
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+357
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 395, 363.5, 350
                    , 357, 350, 357, 350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 357, 357, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+395, sellCostBuyPrice =sellCostBuyPrice+363.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+357
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+357
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+357
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+357
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '150', userid = '1', storedetaildate = '2026-09-20 13:29:47' WHERE storedetailid = '321';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('321', '1', '50', '1', '70', 'اضافة فاتورة مبيعات', 'sellbillController.php', '200', '150', '1', '2026-09-20 13:29:47','0','0'); -- id=1131
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.75','00164', '70', '2', '164', '50', '10', '500', '0', '', '0', '2026-09-20 13:29:47', '164', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','10','500','0','','0','0.00','0','0','0','0'); -- id=452
UPDATE sellbilldetail SET  lastbuyprice = 8.75 , meanbuyprice = 8.75, lastbuyprice_withDiscount = 8.75, meanbuyprice_withDiscount = 8.75
        , lastbuyprice_withTax = 8.75, meanbuyprice_withTax = 8.75, lastbuyprice_withDiscountAndTax = 8.75
                where sellbilldetailid = 452;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (164, '2026-09-20', 500, 437.5, 437.5
                    , 437.5, 437.5, 437.5, 437.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 437.5, 437.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+437.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+437.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+437.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+437.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+437.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+437.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+437.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+437.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 500, 437.5, 437.5
                    , 437.5, 437.5, 437.5, 437.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 437.5, 437.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+437.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+437.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+437.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+437.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+437.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+437.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+437.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+437.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 = '50', userid = '1', storedetaildate = '2026-09-20 13:29:48' WHERE storedetailid = '164';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('164', '1', '50', '1', '70', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '50', '1', '2026-09-20 13:29:48','0','0'); -- id=1132
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.75','00165', '70', '2', '165', '50', '11', '550', '0', '', '0', '2026-09-20 13:29:48', '165', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11','550','0','','0','0.00','0','0','0','0'); -- id=453
UPDATE sellbilldetail SET  lastbuyprice = 8.75 , meanbuyprice = 8.75, lastbuyprice_withDiscount = 8.75, meanbuyprice_withDiscount = 8.75
        , lastbuyprice_withTax = 8.75, meanbuyprice_withTax = 8.75, lastbuyprice_withDiscountAndTax = 8.75
                where sellbilldetailid = 453;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (165, '2026-09-20', 550, 437.5, 437.5
                    , 437.5, 437.5, 437.5, 437.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 437.5, 437.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+550, sellCostBuyPrice =sellCostBuyPrice+437.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+437.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+437.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+437.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+437.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+437.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+437.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+437.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 550, 437.5, 437.5
                    , 437.5, 437.5, 437.5, 437.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 437.5, 437.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+550, sellCostBuyPrice =sellCostBuyPrice+437.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+437.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+437.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+437.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+437.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+437.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+437.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+437.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 = '0', userid = '1', storedetaildate = '2026-09-20 13:29:48' WHERE storedetailid = '165';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('165', '1', '50', '1', '70', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '0', '1', '2026-09-20 13:29:48','0','0'); -- id=1133
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('45','00078', '70', '22', '78', '9', '48', '432', '0', '', '0', '2026-09-20 13:29:48', '78', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','48','432','0','','0','0.00','0','0','0','0'); -- id=454
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 454;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (78, '2026-09-20', 432, 405, 405
                    , 405, 405, 405, 405
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 405, 405, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+432, sellCostBuyPrice =sellCostBuyPrice+405
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+405, sellCostMeanBuyPrice = sellCostMeanBuyPrice+405
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+405, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+405
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+405
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+405
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+405
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 432, 405, 405
                    , 405, 405, 405, 405
                    , 0, 0, 0, 0
                    , 0, 0, 0, 405, 405, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+432, sellCostBuyPrice =sellCostBuyPrice+405
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+405, sellCostMeanBuyPrice = sellCostMeanBuyPrice+405
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+405, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+405
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+405
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+405
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+405
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 13:29:48' WHERE storedetailid = '78';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('78', '1', '9', '1', '70', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '0', '1', '2026-09-20 13:29:48','0','0'); -- id=1134
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.73','00329', '70', '18', '329', '20', '9', '180', '0', '', '0', '2026-09-20 13:29:48', '329', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','9','180','0','','0','0.00','0','0','0','0'); -- id=455
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 455;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (329, '2026-09-20', 180, 174.6, 174.6
                    , 174.6, 174.6, 174.6, 174.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 174.6, 174.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+174.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+174.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+174.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+174.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+174.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+174.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+174.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+174.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-20', 180, 174.6, 174.6
                    , 174.6, 174.6, 174.6, 174.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 174.6, 174.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+180, sellCostBuyPrice =sellCostBuyPrice+174.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+174.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+174.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+174.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+174.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+174.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+174.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+174.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 = '10', userid = '1', storedetaildate = '2026-09-20 13:29:49' WHERE storedetailid = '329';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('329', '1', '20', '1', '70', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '10', '1', '2026-09-20 13:29:49','0','0'); -- id=1135
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-183887.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-185944.984375','2057', '0', '1', 'اضافة فاتورة مبيعات', '70', '-183887.984375', '2026-09-20 13:29:49', '1',  'sellbillController.php','1','','0'); -- id=65
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2057', '2057', '2026-09-20', '1', '0', '0', '2026-09-20 13:29:49','اضافة فاتورة مبيعات رقم 70','1','0',null,'0','70','sellbillController.php?do=showDetail&sellbillid=70'); -- id=663
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('663', '383', '2057', '','0'); -- id=663
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-137195.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('663', '143', '2057', '','0'); -- id=663
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '214529.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1804.6', '1804.6', '2026-09-20', '1', '0', '0', '2026-09-20 13:29:49','اضافة فاتورة مبيعات رقم 70 - صرف البضاعة من المخزن','1','0',null,'0','70','sellbillController.php?do=showDetail&sellbillid=70'); -- id=664
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('664', '402', '1804.6', '','0'); -- id=664
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '201261.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('664', '382', '1804.6', '','0'); -- id=664
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2109882.61', 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='663,0,664' where sellbillid=70;
 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-20', 2057, 1818.1, 1804.6
                    , 1811.6, 1804.6, 1811.6, 1804.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1811.6, 1811.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2057, sellCostBuyPrice =sellCostBuyPrice+1818.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1804.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1811.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1804.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1811.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1804.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1811.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1811.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-20', 2057, 1818.1, 1804.6
                    , 1811.6, 1804.6, 1811.6, 1804.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1811.6, 1811.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2057, sellCostBuyPrice =sellCostBuyPrice+1818.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1804.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1811.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1804.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1811.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1804.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1811.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1811.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, 2057, 1818.1, 1804.6
                    , 1811.6, 1804.6, 1811.6, 1804.6, 1811.6, 1811.6)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2057, netSellCostBuyPrice = netSellCostBuyPrice+1818.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1804.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1811.6
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1804.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1811.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1804.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1811.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1811.6;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafbc89e0690 and sellbillId = 70 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 09:59:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:29:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:29:50', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1741
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:08:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:38:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-20 13:38:29', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=1742
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:08:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:38:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-20 13:38:43', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=1743

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =111
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(3,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '3835' , clientdate = '2026-09-20 13:38:44', userid = '1' WHERE clientid = '3';
UPDATE client SET  inUse = 0 where clientid = 3;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('3','6835.00','3000','1','ايصال تحصيل (( قبض من عميل ))','111', '3835', '2026-09-20 13:38:29', '1', 'clientPayedDeptController.php', '   ', '3000', '0', null, '0', null, null,'', '-1','1','1','3000','1','','7','0','','.'); -- id=111
UPDATE save SET  savecurrentvalue = '-180887.98',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-183887.98','3000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '111', '-180887.98', '2026-09-20 13:38:44', '1',  'clientPayedDeptController.php','3','','0'); -- id=66
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3000', '3000', '2026-09-20', '1', '0', '0', '2026-09-20 13:38:44','اضافة ايصال سداد للعميل عبدالحي الشاذلي ','1','0','0','0','111','clientPayedDeptController.php?do=show&id=111'); -- id=665
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('665', '383', '3000', '','0'); -- id=665
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-134195.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('665', '427', '3000', '','0'); -- id=665
UPDATE accountstree SET name = 'عبدالحي الشاذلي ', customName = 'عبدالحي الشاذلي ', customNameEn = 'عبدالحي الشاذلي ', nameEn = 'عبدالحي الشاذلي ', parent = '58', accountNature = '0', theValue = '3835', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-14 13:19:31' WHERE id = '427';
UPDATE clientdebtchange SET clientid = '3', clientdebtchangebefore = '6835.000', clientdebtchangeamount = '3000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '111', clientdebtchangeafter = '3835.000', clientdebtchangedate = '2026-09-20 13:38:29', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '3000.000',discount='', reciptid='0', dailyentryid = '665',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='3000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '111';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:08:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:38:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-20 13:38:45', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=1744
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:08:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:38:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-20 13:38:47', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=1745
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:13:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:43:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:43:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1746
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:13:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:43:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:43:52', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1747

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafc6e84683b
-- ----------------------------------------------------------------------------------------------------

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-20 13:43:52', '06aafc6e84683b', '1', '0.00', '0', '0', '1', '975.00', '975', '975', '0', '1', '2026-09-20 13:43:52', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '5' ,'0','','','','','-1','0','0','0','0','0','975','0','','0','0','975','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=71
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','اضافة فاتورة مبيعات','71', '0', '2026-09-20 13:43:53', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '975', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 13:43:52','0','0','',''); -- 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 ('160','00084', '71', '12', '84', '5', '195', '975', '0', '', '1', '2026-09-20 13:43:53', '84', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','195','975','0','','0','0.00','0','0','0','0'); -- id=456
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 160.00
        , lastbuyprice_withTax = 160, meanbuyprice_withTax = 160, lastbuyprice_withDiscountAndTax = 160
                where sellbilldetailid = 456;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (84, '2026-09-20', 975, 800, 800
                    , 800, 800, 800, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 800, 800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 975, 800, 800
                    , 800, 800, 800, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 13:43:53' WHERE storedetailid = '84';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('84', '1', '5', '1', '71', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '27', '1', '2026-09-20 13:43:53','0','0'); -- id=1136
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-179912.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-180887.984375','975', '0', '1', 'اضافة فاتورة مبيعات', '71', '-179912.984375', '2026-09-20 13:43:54', '1',  'sellbillController.php','1','','0'); -- id=67
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '975', '975', '2026-09-20', '1', '0', '0', '2026-09-20 13:43:54','اضافة فاتورة مبيعات رقم 71','1','0',null,'0','71','sellbillController.php?do=showDetail&sellbillid=71'); -- id=666
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('666', '383', '975', '','0'); -- id=666
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-133220.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('666', '143', '975', '','0'); -- id=666
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '215504.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '800', '800', '2026-09-20', '1', '0', '0', '2026-09-20 13:43:54','اضافة فاتورة مبيعات رقم 71 - صرف البضاعة من المخزن','1','0',null,'0','71','sellbillController.php?do=showDetail&sellbillid=71'); -- id=667
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('667', '402', '800', '','0'); -- id=667
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '202061.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('667', '382', '800', '','0'); -- id=667
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2109082.61', 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='666,0,667' where sellbillid=71;
 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-20', 975, 800, 800
                    , 800, 800, 800, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,800, 800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+800
                        , returnSellVal = returnSellVal+0, 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-20', 975, 800, 800
                    , 800, 800, 800, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,800, 800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+975, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+800
                        , returnSellVal = returnSellVal+0, 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, 975, 800, 800
                    , 800, 800, 800, 800, 800, 800)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+975, netSellCostBuyPrice = netSellCostBuyPrice+800
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+800
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+800
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+800
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+800
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+800
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+800
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+800;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafc6e84683b and sellbillId = 71 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:13:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 13:43:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 13:43:55', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1748
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:35:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:05:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 14:05:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=1749
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:36:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:06:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 14:06:02', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1750
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:36:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:06:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:06:10', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=42'); -- id=1751
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:36:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:06:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:06:34', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1752
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:36:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:06:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:06:41', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1753
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:36:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:06:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:06:46', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=42'); -- id=1754
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:37:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:07:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:07:23', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1755
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 42;
UPDATE sellbill SET  sellbillsysdate = '2026-09-20 14:07:23', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '42';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 9;
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 241;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-09-20', 96, 94, 94
                    , 94, 94, 94, 94
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 94, 94, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-96, sellCostBuyPrice =sellCostBuyPrice-94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-94, sellCostMeanBuyPrice = sellCostMeanBuyPrice-94
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-94
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-94
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 96, 94, 94
                    , 94, 94, 94, 94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 94, 94, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-96, sellCostBuyPrice =sellCostBuyPrice-94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-94, sellCostMeanBuyPrice = sellCostMeanBuyPrice-94
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-94
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-94
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1356', userid = '1', storedetaildate = '2026-09-20 14:07:23' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '8', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1348', '1356', '1', '2026-09-16 22:19:56','0','0'); -- id=1137
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 13;
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 242;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-09-20', 159.75, 158.4, 158.4
                    , 158.4, 158.4, 158.4, 158.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 158.4, 158.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-159.75, sellCostBuyPrice =sellCostBuyPrice-158.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-158.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-158.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-158.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-158.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-158.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-158.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-158.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-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-20', 159.75, 158.4, 158.4
                    , 158.4, 158.4, 158.4, 158.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 158.4, 158.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-159.75, sellCostBuyPrice =sellCostBuyPrice-158.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-158.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-158.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-158.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-158.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-158.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-158.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-158.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 = '375', userid = '1', storedetaildate = '2026-09-20 14:07:23' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '9', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '366', '375', '1', '2026-09-16 22:19:56','0','0'); -- id=1138
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 14;
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 243;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-09-20', 106.5, 105.6, 105.6
                    , 105.6, 105.6, 105.6, 105.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 105.6, 105.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-106.5, sellCostBuyPrice =sellCostBuyPrice-105.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-105.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-105.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-105.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-105.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-105.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-105.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-105.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-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-20', 106.5, 105.6, 105.6
                    , 105.6, 105.6, 105.6, 105.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 105.6, 105.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-106.5, sellCostBuyPrice =sellCostBuyPrice-105.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-105.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-105.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-105.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-105.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-105.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-105.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-105.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 = '426', userid = '1', storedetaildate = '2026-09-20 14:07:23' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '6', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '420', '426', '1', '2026-09-16 22:19:56','0','0'); -- id=1139
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 8;
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 244;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-09-20', 49.5, 40.5, 40.5
                    , 40.5, 40.5, 40.5, 40.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 40.5, 40.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-49.5, sellCostBuyPrice =sellCostBuyPrice-40.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-40.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-40.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-40.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-40.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-40.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-40.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-40.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-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-20', 49.5, 40.5, 40.5
                    , 40.5, 40.5, 40.5, 40.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40.5, 40.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-49.5, sellCostBuyPrice =sellCostBuyPrice-40.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-40.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-40.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-40.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-40.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-40.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-40.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-40.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 = '2074', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '9', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2065', '2074', '1', '2026-09-16 22:19:56','0','0'); -- id=1140
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 = 245;
 INSERT INTO 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-20', 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-20', 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 = '628', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '626', '628', '1', '2026-09-16 22:19:56','0','0'); -- id=1141
UPDATE sellbilldetail SET  lastbuyprice = 173.25 , meanbuyprice = 173.25, lastbuyprice_withDiscount = 173.25, meanbuyprice_withDiscount = 173.25
        , lastbuyprice_withTax = 173.25, meanbuyprice_withTax = 173.25, lastbuyprice_withDiscountAndTax = 173.25
                where sellbilldetailid = 246;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (146, '2026-09-20', 350, 346.5, 346.5
                    , 346.5, 346.5, 346.5, 346.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 346.5, 346.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-350, sellCostBuyPrice =sellCostBuyPrice-346.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-346.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-346.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-346.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-346.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-346.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-346.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-346.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 350, 346.5, 346.5
                    , 346.5, 346.5, 346.5, 346.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 346.5, 346.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-350, sellCostBuyPrice =sellCostBuyPrice-346.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-346.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-346.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-346.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-346.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-346.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-346.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-346.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 = '10', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '146';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('146', '1', '2', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '8', '10', '1', '2026-09-16 22:19:56','0','0'); -- id=1142
UPDATE sellbilldetail SET  lastbuyprice = 263.00 , meanbuyprice = 263.00, lastbuyprice_withDiscount = 263.00, meanbuyprice_withDiscount = 263.00
        , lastbuyprice_withTax = 263, meanbuyprice_withTax = 263, lastbuyprice_withDiscountAndTax = 263
                where sellbilldetailid = 247;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (290, '2026-09-20', 266, 263, 263
                    , 263, 263, 263, 263
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 263, 263, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-266, sellCostBuyPrice =sellCostBuyPrice-263
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-263, sellCostMeanBuyPrice = sellCostMeanBuyPrice-263
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-263, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-263
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-263
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-263
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-263
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 266, 263, 263
                    , 263, 263, 263, 263
                    , 0, 0, 0, 0
                    , 0, 0, 0, 263, 263, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-266, sellCostBuyPrice =sellCostBuyPrice-263
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-263, sellCostMeanBuyPrice = sellCostMeanBuyPrice-263
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-263, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-263
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-263
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-263
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-263
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 14:07:24' WHERE storedetailid = '290';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('290', '1', '1', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9', '10', '1', '2026-09-16 22:19:56','0','0'); -- id=1143
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 248;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (289, '2026-09-20', 350, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-350, sellCostBuyPrice =sellCostBuyPrice-300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 350, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-350, sellCostBuyPrice =sellCostBuyPrice-300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-300, sellCostMeanBuyPrice = sellCostMeanBuyPrice-300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-300
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '289';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('289', '1', '1', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '11', '12', '1', '2026-09-16 22:19:56','0','0'); -- id=1144
UPDATE sellbilldetail SET  lastbuyprice = 20.50 , meanbuyprice = 20.50, lastbuyprice_withDiscount = 20.50, meanbuyprice_withDiscount = 20.50
        , lastbuyprice_withTax = 20.5, meanbuyprice_withTax = 20.5, lastbuyprice_withDiscountAndTax = 20.5
                where sellbilldetailid = 249;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (188, '2026-09-20', 200, 164, 164
                    , 164, 164, 164, 164
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 164, 164, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-200, sellCostBuyPrice =sellCostBuyPrice-164
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-164, sellCostMeanBuyPrice = sellCostMeanBuyPrice-164
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-164, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-164
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-164
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-164
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-164
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 200, 164, 164
                    , 164, 164, 164, 164
                    , 0, 0, 0, 0
                    , 0, 0, 0, 164, 164, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-200, sellCostBuyPrice =sellCostBuyPrice-164
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-164, sellCostMeanBuyPrice = sellCostMeanBuyPrice-164
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-164, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-164
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-164
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-164
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-164
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 14:07:24' WHERE storedetailid = '188';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('188', '1', '8', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '29', '37', '1', '2026-09-16 22:19:56','0','0'); -- id=1145
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 = 250;
 INSERT INTO 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-20', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-76.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85, sellCostBuyPrice =sellCostBuyPrice-76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-76.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 = '26', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '1', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '25', '26', '1', '2026-09-16 22:19:56','0','0'); -- id=1146
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 = 251;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (79, '2026-09-20', 39, 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-39, 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-20', 39, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-39, 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 = '20', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '79';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('79', '1', '1', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-16 22:19:56','0','0'); -- id=1147
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 12;
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 252;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (105, '2026-09-20', 120, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-20', 120, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-120, sellCostMeanBuyPrice = sellCostMeanBuyPrice-120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-120
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '270', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '8', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '262', '270', '1', '2026-09-16 22:19:56','0','0'); -- id=1148
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 = 253;
 INSERT INTO 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-20', 15, 11, 11
                    , 11, 11, 11, 11
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 11, 11, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-11
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , 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-20', 15, 11, 11
                    , 11, 11, 11, 11
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11, 11, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15, sellCostBuyPrice =sellCostBuyPrice-11
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-11, sellCostMeanBuyPrice = sellCostMeanBuyPrice-11
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-11, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-11
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-11
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '149', userid = '1', storedetaildate = '2026-09-20 14:07:24' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '1', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '148', '149', '1', '2026-09-16 22:19:56','0','0'); -- id=1149
UPDATE sellbilldetail SET  lastbuyprice = 39.90 , meanbuyprice = 39.90, lastbuyprice_withDiscount = 39.90, meanbuyprice_withDiscount = 39.90
        , lastbuyprice_withTax = 39.9, meanbuyprice_withTax = 39.9, lastbuyprice_withDiscountAndTax = 39.9
                where sellbilldetailid = 254;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (135, '2026-09-20', 159.6, 159.6, 159.6
                    , 159.6, 159.6, 159.6, 159.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 159.6, 159.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-159.6, sellCostBuyPrice =sellCostBuyPrice-159.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.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-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-20', 159.6, 159.6, 159.6
                    , 159.6, 159.6, 159.6, 159.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.6, 159.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-159.6, sellCostBuyPrice =sellCostBuyPrice-159.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-159.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-159.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-159.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-159.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-159.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-159.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-159.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 = '58', userid = '1', storedetaildate = '2026-09-20 14:07:25' WHERE storedetailid = '135';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('135', '1', '4', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '54', '58', '1', '2026-09-16 22:19:56','0','0'); -- id=1150
UPDATE storedetail SET productquantity = (select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 348)
                , userid = 1, storedetaildate = "2026-09-20" WHERE  unittype = 0 and storedetailid = 348 ;
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 = 348;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (348, '2026-09-20', 250, 200, 200
                    , 200, 200, 200, 200
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 200, 200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-250, sellCostBuyPrice =sellCostBuyPrice-200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 250, 200, 200
                    , 200, 200, 200, 200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200, 200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-250, sellCostBuyPrice =sellCostBuyPrice-200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-200
                        , returnSellVal = returnSellVal-0, 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('348', '1', '1', '0', '42', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '1', '1', '2026-09-16 22:19:56','0','0'); -- id=1151
CALL clientInUse(11,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '11';
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 ('11','0.00','0.00','1','تعديل فاتورة مبيعات','42', '0', '2026-09-16 22:19:56', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '2284.35', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-16 22:19:56','0','0','',''); -- id=113
UPDATE client SET  inUse = 0 where clientid = 11;
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-182197.334375',  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 ('-179912.984375','2284.35', '1', '1', 'تعديل فاتورة مبيعات', '42', '-182197.334375', '2026-09-20 14:07:25', '1',  'sellbillController.php','11','','0'); -- id=68
 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-20', 2284.35, 2110.1, 2110.1
                    , 2110.1, 2110.1, 2110.1, 2110.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2110.1, 2110.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2284.35, sellCostBuyPrice =sellCostBuyPrice-2110.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2110.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2110.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2110.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2110.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2110.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2110.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2110.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-09-20', 2284.35, 2110.1, 2110.1
                    , 2110.1, 2110.1, 2110.1, 2110.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2110.1, 2110.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2284.35, sellCostBuyPrice =sellCostBuyPrice-2110.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2110.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2110.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2110.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2110.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2110.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2110.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2110.1
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2284.35, 2110.1, 2110.1
                    , 2110.1, 2110.1, 2110.1, 2110.1, 2110.1, 2110.1)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-2284.35, netSellCostBuyPrice = netSellCostBuyPrice-2110.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-2110.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-2110.1
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-2110.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-2110.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-2110.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-2110.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-2110.1;

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


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

COMMIT;
BEGIN;
CALL clientInUse(11,@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-16 22:19:56', '06aaacae144262', '11', '0.00', '100', '0', '1', '2384.35', '2384.35', '2284.35', '100', '1', '2026-09-16 22:19:56', '', '1', '0', 'خالد ابوجبل ', '1', '1', '3', '0', 'خالد ابوجبل ', '62', '42', 'sellbillController', '0','','','','','-1','0','0','2284.35','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-16','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=72
UPDATE client SET  clientdebt = '100', userid = '1' WHERE clientid = '11';
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 ('11','0.00','100','0','اضافة فاتورة مبيعات (معدله)','72', '100', '2026-09-20 14:07:26', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2384.35', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-16 22:19:56','0','0','',''); -- id=114
UPDATE client SET  inUse = 0 where clientid = 11;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 9;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '72', '3', '102', '8.00', '12', '96', '0', '', '1', '2026-09-20 14:07:26', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','9-8,','1','1','0','0','12','96','0','','0','0.00','0','0','0','0'); -- id=457
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 457;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-09-20', 96, 94, 94
                    , 94, 94, 94, 94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 94, 94, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+96, sellCostBuyPrice =sellCostBuyPrice+94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+94, sellCostMeanBuyPrice = sellCostMeanBuyPrice+94
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+94
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+94
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 96, 94, 94
                    , 94, 94, 94, 94
                    , 0, 0, 0, 0
                    , 0, 0, 0, 94, 94, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+96, sellCostBuyPrice =sellCostBuyPrice+94
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+94, sellCostMeanBuyPrice = sellCostMeanBuyPrice+94
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+94, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+94
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+94
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+94
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+94
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1348', userid = '1', storedetaildate = '2026-09-20 14:07:26' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '8', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1356', '1348', '1', '2026-09-20 14:07:26','0','0'); -- id=1152
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '72', '3', '100', '9.00', '17.75', '159.75', '0', '', '1', '2026-09-20 14:07:26', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','13-9,','1','1','0','0','17.75','159.75','0','','0','0.00','0','0','0','0'); -- id=458
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 458;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-09-20', 159.75, 158.4, 158.4
                    , 158.4, 158.4, 158.4, 158.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 158.4, 158.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+159.75, sellCostBuyPrice =sellCostBuyPrice+158.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.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+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-20', 159.75, 158.4, 158.4
                    , 158.4, 158.4, 158.4, 158.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 158.4, 158.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+159.75, sellCostBuyPrice =sellCostBuyPrice+158.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.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 = '366', userid = '1', storedetaildate = '2026-09-20 14:07:27' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '9', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '375', '366', '1', '2026-09-20 14:07:27','0','0'); -- id=1153
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 14;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00101', '72', '3', '101', '6.00', '17.75', '106.5', '0', '', '1', '2026-09-20 14:07:27', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','14-6,','1','1','0','0','17.75','106.5','0','','0','0.00','0','0','0','0'); -- id=459
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 459;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-09-20', 106.5, 105.6, 105.6
                    , 105.6, 105.6, 105.6, 105.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 105.6, 105.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+106.5, sellCostBuyPrice =sellCostBuyPrice+105.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105.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+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-20', 106.5, 105.6, 105.6
                    , 105.6, 105.6, 105.6, 105.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 105.6, 105.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+106.5, sellCostBuyPrice =sellCostBuyPrice+105.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105.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 = '420', userid = '1', storedetaildate = '2026-09-20 14:07:27' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '6', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '426', '420', '1', '2026-09-20 14:07:27','0','0'); -- id=1154
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '72', '3', '103', '9.00', '5.5', '49.5', '0', '', '1', '2026-09-20 14:07:27', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-9,','1','1','0','0','5.5','49.5','0','','0','0.00','0','0','0','0'); -- id=460
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 460;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-09-20', 49.5, 40.5, 40.5
                    , 40.5, 40.5, 40.5, 40.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 40.5, 40.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49.5, sellCostBuyPrice =sellCostBuyPrice+40.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.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+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-20', 49.5, 40.5, 40.5
                    , 40.5, 40.5, 40.5, 40.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40.5, 40.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49.5, sellCostBuyPrice =sellCostBuyPrice+40.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.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 = '2065', userid = '1', storedetaildate = '2026-09-20 14:07:27' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '9', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '2074', '2065', '1', '2026-09-20 14:07:28','0','0'); -- id=1155
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '72', '14', '81', '2.00', '19', '38', '0', '', '1', '2026-09-20 14:07:28', '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=461
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 = 461;
 INSERT INTO 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-20', 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-20', 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 = '626', userid = '1', storedetaildate = '2026-09-20 14:07:28' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '628', '626', '1', '2026-09-20 14:07:28','0','0'); -- id=1156
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('173.25','00146', '72', '21', '146', '2.00', '175', '350', '0', '', '1', '2026-09-20 14:07:28', '146', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','175','350','0','','0','0.00','0','0','0','0'); -- id=462
UPDATE sellbilldetail SET  lastbuyprice = 173.25 , meanbuyprice = 173.25, lastbuyprice_withDiscount = 173.25, meanbuyprice_withDiscount = 173.25
        , lastbuyprice_withTax = 173.25, meanbuyprice_withTax = 173.25, lastbuyprice_withDiscountAndTax = 173.25
                where sellbilldetailid = 462;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (146, '2026-09-20', 350, 346.5, 346.5
                    , 346.5, 346.5, 346.5, 346.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 346.5, 346.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+346.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+346.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+346.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+346.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+346.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+346.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+346.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+346.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 350, 346.5, 346.5
                    , 346.5, 346.5, 346.5, 346.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 346.5, 346.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+346.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+346.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+346.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+346.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+346.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+346.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+346.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+346.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 = '8', userid = '1', storedetaildate = '2026-09-20 14:07:28' WHERE storedetailid = '146';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('146', '1', '2', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '8', '1', '2026-09-20 14:07:28','0','0'); -- id=1157
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('263','00290', '72', '24', '290', '1.00', '266', '266', '0', '', '1', '2026-09-20 14:07:28', '290', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','266','266','0','','0','0.00','0','0','0','0'); -- id=463
UPDATE sellbilldetail SET  lastbuyprice = 263.00 , meanbuyprice = 263.00, lastbuyprice_withDiscount = 263.00, meanbuyprice_withDiscount = 263.00
        , lastbuyprice_withTax = 263, meanbuyprice_withTax = 263, lastbuyprice_withDiscountAndTax = 263
                where sellbilldetailid = 463;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (290, '2026-09-20', 266, 263, 263
                    , 263, 263, 263, 263
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 263, 263, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+266, sellCostBuyPrice =sellCostBuyPrice+263
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+263, sellCostMeanBuyPrice = sellCostMeanBuyPrice+263
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+263, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+263
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+263
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+263
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+263
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 266, 263, 263
                    , 263, 263, 263, 263
                    , 0, 0, 0, 0
                    , 0, 0, 0, 263, 263, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+266, sellCostBuyPrice =sellCostBuyPrice+263
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+263, sellCostMeanBuyPrice = sellCostMeanBuyPrice+263
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+263, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+263
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+263
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+263
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+263
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 14:07:29' WHERE storedetailid = '290';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('290', '1', '1', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '10', '9', '1', '2026-09-20 14:07:29','0','0'); -- id=1158
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','00289', '72', '7', '289', '1.00', '350', '350', '0', '', '1', '2026-09-20 14:07:29', '289', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','350','350','0','','0','0.00','0','0','0','0'); -- id=464
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 464;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (289, '2026-09-20', 350, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 350, 300, 300
                    , 300, 300, 300, 300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 300, 300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 14:07:29' WHERE storedetailid = '289';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('289', '1', '1', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '12', '11', '1', '2026-09-20 14:07:29','0','0'); -- id=1159
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.5','00188', '72', '20', '188', '8.00', '25', '200', '0', '', '1', '2026-09-20 14:07:29', '188', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','25','200','0','','0','0.00','0','0','0','0'); -- id=465
UPDATE sellbilldetail SET  lastbuyprice = 20.50 , meanbuyprice = 20.50, lastbuyprice_withDiscount = 20.50, meanbuyprice_withDiscount = 20.50
        , lastbuyprice_withTax = 20.5, meanbuyprice_withTax = 20.5, lastbuyprice_withDiscountAndTax = 20.5
                where sellbilldetailid = 465;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (188, '2026-09-20', 200, 164, 164
                    , 164, 164, 164, 164
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 164, 164, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+164
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+164, sellCostMeanBuyPrice = sellCostMeanBuyPrice+164
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+164, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+164
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+164
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+164
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+164
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 200, 164, 164
                    , 164, 164, 164, 164
                    , 0, 0, 0, 0
                    , 0, 0, 0, 164, 164, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+164
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+164, sellCostMeanBuyPrice = sellCostMeanBuyPrice+164
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+164, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+164
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+164
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+164
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+164
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 14:07:29' WHERE storedetailid = '188';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('188', '1', '8', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '37', '29', '1', '2026-09-20 14:07:29','0','0'); -- id=1160
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '72', '7', '320', '1.00', '85', '85', '0', '', '1', '2026-09-20 14:07:29', '320', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=466
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 = 466;
 INSERT INTO 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-20', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+76.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 85, 76.5, 76.5
                    , 76.5, 76.5, 76.5, 76.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 76.5, 76.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+76.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+76.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+76.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+76.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+76.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+76.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+76.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+76.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-20 14:07:30' WHERE storedetailid = '320';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('320', '1', '1', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '26', '25', '1', '2026-09-20 14:07:30','0','0'); -- id=1161
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00079', '72', '22', '79', '1.00', '39', '39', '0', '', '1', '2026-09-20 14:07:30', '79', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','39','0','','0','0.00','0','0','0','0'); -- id=467
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 = 467;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (79, '2026-09-20', 39, 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+39, 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-20', 39, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+39, 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 = '19', userid = '1', storedetaildate = '2026-09-20 14:07:30' WHERE storedetailid = '79';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('79', '1', '1', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-20 14:07:30','0','0'); -- id=1162
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 12;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00105', '72', '3', '105', '8.00', '15', '120', '0', '', '1', '2026-09-20 14:07:30', '105', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','12-8,','1','1','0','0','15','120','0','','0','0.00','0','0','0','0'); -- id=468
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 468;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (105, '2026-09-20', 120, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 120, 120, 120
                    , 120, 120, 120, 120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '262', userid = '1', storedetaildate = '2026-09-20 14:07:30' WHERE storedetailid = '105';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('105', '1', '8', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '270', '262', '1', '2026-09-20 14:07:30','0','0'); -- id=1163
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '72', '6', '207', '1.00', '15', '15', '0', '', '1', '2026-09-20 14:07:30', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','15','0','','0','0.00','0','0','0','0'); -- id=469
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 = 469;
 INSERT INTO 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-20', 15, 11, 11
                    , 11, 11, 11, 11
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11, 11, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+11
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , 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-20', 15, 11, 11
                    , 11, 11, 11, 11
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11, 11, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+11
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '148', userid = '1', storedetaildate = '2026-09-20 14:07:31' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '1', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '149', '148', '1', '2026-09-20 14:07:31','0','0'); -- id=1164
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.9','00135', '72', '21', '135', '4.00', '39.9', '159.6', '0', '', '1', '2026-09-20 14:07:31', '135', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39.9','159.6','0','','0','0.00','0','0','0','0'); -- id=470
UPDATE sellbilldetail SET  lastbuyprice = 39.90 , meanbuyprice = 39.90, lastbuyprice_withDiscount = 39.90, meanbuyprice_withDiscount = 39.90
        , lastbuyprice_withTax = 39.9, meanbuyprice_withTax = 39.9, lastbuyprice_withDiscountAndTax = 39.9
                where sellbilldetailid = 470;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (135, '2026-09-20', 159.6, 159.6, 159.6
                    , 159.6, 159.6, 159.6, 159.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 159.6, 159.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+159.6, sellCostBuyPrice =sellCostBuyPrice+159.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.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+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-20', 159.6, 159.6, 159.6
                    , 159.6, 159.6, 159.6, 159.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.6, 159.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+159.6, sellCostBuyPrice =sellCostBuyPrice+159.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.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 = '54', userid = '1', storedetaildate = '2026-09-20 14:07:31' WHERE storedetailid = '135';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('135', '1', '4', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '54', '1', '2026-09-20 14:07:31','0','0'); -- id=1165
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00348', '72', '25', '348', '1.00', '350', '350', '0', '', '1', '2026-09-20 14:07:31', '348', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','350','350','0','','0','0.00','0','0','0','0'); -- id=471
UPDATE storedetail SET productquantity = (select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 348)
                , userid = 1, storedetaildate = "2026-09-20" WHERE  unittype = 0 and storedetailid = 348 ;
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 = 348;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (348, '2026-09-20', 350, -200, -200
                    , -200, -200, -200, -200
                    , 0, 0, 0, 0
                    , 0, 0, 0, -1, 0, -200, -200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+-200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+-200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+-200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+-200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+-200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+-200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+-200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+-200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 350, -200, -200
                    , -200, -200, -200, -200
                    , 0, 0, 0, 0
                    , 0, 0, 0, -200, -200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+-200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+-200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+-200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+-200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+-200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+-200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+-200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+-200
                        , returnSellVal = returnSellVal+0, 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('348', '1', '1', '1', '72', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '0', '-1', '1', '2026-09-20 14:07:31','0','0'); -- id=1166
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-179912.978125',  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 ('-182197.328125','2284.35', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '72', '-179912.978125', '2026-09-20 14:07:32', '1',  'sellbillController.php','11','','0'); -- id=69
UPDATE dailyentry SET totalcreditor = '2284.35', totaldebtor = '2284.35', thedate = '2026-09-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-17 22:29:26', entryComment = 'اضافة فاتورة مبيعات رقم 42', fromFlag = '1',related='0',isopeningentry='0',operationId='42',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=42' WHERE id = '543';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2284.35', '2284.35', '2026-09-20', '1', '0', '543', '2026-09-20 14:07:32','تم عكس القيد رقم 543 ','1','0','0','0','0',''); -- id=668
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('668', '438', '2284.35', '','0'); -- id=668
UPDATE accountstree SET name = 'خالد ابوجبل ', customName = 'خالد ابوجبل ', customNameEn = 'خالد ابوجبل ', nameEn = 'خالد ابوجبل ', parent = '58', accountNature = '0', theValue = '-2284.35', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 19:27:51' WHERE id = '438';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('668', '143', '2284.35', '','0'); -- id=668
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '213220.49', 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 = '2284.35', totaldebtor = '2284.35', thedate = '2026-09-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-17 22:29:26', entryComment = 'اضافة فاتورة مبيعات رقم 42 - تحصيل الفاتورة من العميل', fromFlag = '1',related='0',isopeningentry='0',operationId='42',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=42' WHERE id = '544';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2284.35', '2284.35', '2026-09-20', '1', '0', '544', '2026-09-20 14:07:32','تم عكس القيد رقم 544 ','1','0','0','0','0',''); -- id=669
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('669', '383', '2284.35', '','0'); -- id=669
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-135505.33', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('669', '438', '2284.35', '','0'); -- id=669
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-16 19:27:51' WHERE id = '438';
UPDATE dailyentry SET totalcreditor = '2110.10', totaldebtor = '2110.10', thedate = '2026-09-17', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-17 22:29:26', entryComment = 'اضافة فاتورة مبيعات رقم 42 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='42',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=42' WHERE id = '545';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2110.10', '2110.10', '2026-09-20', '1', '0', '545', '2026-09-20 14:07:33','تم عكس القيد رقم 545 ','1','0','0','0','0',''); -- id=670
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('670', '402', '2110.10', '','0'); -- id=670
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '199951.36', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('670', '382', '2110.10', '','0'); -- id=670
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2111192.71', 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 ( '2384.35', '2384.35', '2026-09-20', '1', '0', '0', '2026-09-20 14:07:33','اضافة فاتورة مبيعات رقم 72','1','0',null,'0','72','sellbillController.php?do=showDetail&sellbillid=72'); -- id=671
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('671', '438', '2384.35', '','0'); -- id=671
UPDATE accountstree SET name = 'خالد ابوجبل ', customName = 'خالد ابوجبل ', customNameEn = 'خالد ابوجبل ', nameEn = 'خالد ابوجبل ', parent = '58', accountNature = '0', theValue = '2384.35', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 19:27:51' WHERE id = '438';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('671', '143', '2384.35', '','0'); -- id=671
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '215604.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2284.35', '2284.35', '2026-09-20', '1', '0', '0', '2026-09-20 14:07:33','اضافة فاتورة مبيعات رقم 72 - تحصيل الفاتورة من العميل','1','0',null,'0','72','sellbillController.php?do=showDetail&sellbillid=72'); -- id=672
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('672', '383', '2284.35', '','0'); -- id=672
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-133220.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('672', '438', '2284.35', '','0'); -- id=672
UPDATE accountstree SET name = 'خالد ابوجبل ', customName = 'خالد ابوجبل ', customNameEn = 'خالد ابوجبل ', nameEn = 'خالد ابوجبل ', parent = '58', accountNature = '0', theValue = '100', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 19:27:51' WHERE id = '438';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1710.1', '1710.1', '2026-09-20', '1', '0', '0', '2026-09-20 14:07:33','اضافة فاتورة مبيعات رقم 72 - صرف البضاعة من المخزن','1','0',null,'0','72','sellbillController.php?do=showDetail&sellbillid=72'); -- id=673
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('673', '402', '1710.1', '','0'); -- id=673
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '201661.46', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('673', '382', '1710.1', '','0'); -- id=673
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2109482.61', 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='671,672,673' where sellbillid=72;
 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-20', 2384.35, 1710.1, 1710.1
                    , 1710.1, 1710.1, 1710.1, 1710.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1710.1, 1710.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2384.35, sellCostBuyPrice =sellCostBuyPrice+1710.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1710.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1710.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1710.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1710.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1710.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1710.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1710.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-09-20', 2384.35, 1710.1, 1710.1
                    , 1710.1, 1710.1, 1710.1, 1710.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1710.1, 1710.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2384.35, sellCostBuyPrice =sellCostBuyPrice+1710.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1710.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1710.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1710.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1710.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1710.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1710.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1710.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2384.35, 1710.1, 1710.1
                    , 1710.1, 1710.1, 1710.1, 1710.1, 1710.1, 1710.1)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2384.35, netSellCostBuyPrice = netSellCostBuyPrice+1710.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1710.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1710.1
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1710.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1710.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1710.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1710.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1710.1;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 42 and newid=72 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:37:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:07:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:07:35', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=72'); -- id=1756
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:51:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:21:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:21:23', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1757
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:51:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:21:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 14:21:34', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1758
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:51:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:21:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 14:21:44', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1759
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 10:57:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:27:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-20 14:27:59', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=1760
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('سعيد صفوت ', '', '', '19950', '', '0', '1', '2026-09-20 14:29:51', '0', '', '','0','0','','','','','','','','','','0','0','1','19950','0','0'); -- id=12
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 ('12', '0', '19950', '0', 'إضافة مورد جديد', '12', '19950', '2026-09-20 14:29:51', '1', 'supplierController.php', '', '0','', '0','1','1','19950','1','0','0','0','0',''); -- id=29
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('سعيد صفوت ', 'سعيد صفوت ', 'سعيد صفوت ', 'سعيد صفوت ', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '1', '0', '2026-09-20 14:29:51'); -- id=446
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19950', '19950', '2026-09-20', '1', '0', '0', '2026-09-20 14:29:52','إضافة مورد سعيد صفوت ','1','0','0','0','0',''); -- id=674
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('674', '121', '19950', '','0'); -- id=674
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1156737.37', 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';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('674', '446', '19950', '','0'); -- id=674
UPDATE accountstree SET name = 'سعيد صفوت ', customName = 'سعيد صفوت ', customNameEn = 'سعيد صفوت ', nameEn = 'سعيد صفوت ', parent = '81', accountNature = '1', theValue = '19950', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:29:51' WHERE id = '446';
COMMIT;
UPDATE supplier SET suppliername = 'سعيد صفوت ', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '19950.00', supplierdetails = '', conditions = '0', userid = '1', supplierdate = '2026-09-20', dailyentryid = '674', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='446',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='19950',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '12';
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 ('نجفه موديل k39 ثلاثي اسمر ','','16','1750','1900','1980','1900','2026-09-20','0','1','1','','0','0','0','0','0','1750','1750','1750','1750','1750','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','1750','1750','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=426
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (426, 1,'2026-09-20 14:31:44',1)
                ON DUPLICATE KEY UPDATE productid = 426, edited = 1, sysdate = '2026-09-20 14:31:44', userid = 1; -- id=530
UPDATE product SET productName = 'نجفه موديل k39 ثلاثي اسمر ', productDescription = '', productCatId = '16', productBuyPrice = '1750', productSellAllPrice = '1900', productSellUnitPrice = '1980', productSellHalfPrice = '1900', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '1', parcode = '00426',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1750',lastbuyprice_withDiscount = '1750',meanbuyprice = '1750',meanbuyprice_withDiscount = '1750' , productbuypricereal = '1750' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='1750',meanbuyprice_withTax='1750',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '426';
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', '426', '1', '2026-09-20', '1', '0','0042601','1900','1900','1980','1750','','0','0','0','0','0','0','0','0','0','0'); -- id=426
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('426', '1', '0', '1', '2026-09-20'); -- id=426
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('426', '1', '0', '0', '426', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-09-20','0','0'); -- id=1167
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:03:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:33:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-20 14:33:50', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=1761
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 ('06aafd1650b092', '2026-09-20 14:28:21', '12', '19950.00', '53150', '0', '0', '33200.00',  '33200.00', '0', '33200', '1', '2026-09-20 14:33:50', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=11
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 ('00381', '11', '16', '381', '4', '1800', '7200.00', '0', '', '2026-09-20 14:33:50', '381','','','0','0','0','0','0',null,'1800','7200','0','0','0','0','0','0','0','0','1'); -- id=30
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-20 14:28:21', 1, 381, 0, 0
                    , 1800, 4, 0, 0, 1, '2026-09-20 14:33:51')
                ON DUPLICATE KEY UPDATE buyprice = 1800,
                        buyQuantity =buyQuantity+4, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-20 14:33:51' ; -- id=30
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('381', '1800', '4', '0', 'buyBillController.php', '30', '', '0', '0'); -- id=30
UPDATE product SET  productBuyPrice = "1800" WHERE productId = 381 ;
UPDATE buybilldetail SET  quantitybefore = 4 WHERE buybilldetailid = 30 ;
UPDATE product SET productName = 'نجفه موديل k18 اسمر ثلاثي مستورد ', productDescription = '', productCatId = '16', productBuyPrice = '1800.00', productSellAllPrice = '1900.00', productSellUnitPrice = '2150.00', productSellHalfPrice = '1900.00', productDate = '2026-09-17', conditions = '0', userId = '1', limitamount = '1', parcode = '00381',type ='0', expireDate = '0' , dailyentryId = '487',isService = '0',isOptic = '0',lastbuyprice = '1800',lastbuyprice_withDiscount = '1800',meanbuyprice = '1800',meanbuyprice_withDiscount = '1800' , productbuypricereal = '1800.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.56' , buyhalf_precentage = '5.56' , buypart_precentage = '19.44',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1800',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='1800',meanbuyprice_withTax='1800',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='1800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '381';
UPDATE buybilldetail SET  lastbuyprice = 1800 , meanbuyprice = 1800, lastbuyprice_withDiscount = 1800, meanbuyprice_withDiscount = 1800
        , lastbuyprice_withTax = 1800, meanbuyprice_withTax = 1800, lastbuyprice_withDiscountAndTax = 1800
                where buybilldetailid = 30;
UPDATE productunit SET proUnitBuyPrice  = 1800 * productnumber WHERE productid = 381;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-09-20' WHERE storedetailid = '381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('381', '1', '4', '0', '11', 'اضافة فاتورة مشتريات', 'buyBillController.php', '4', '8', '1', '2026-09-20 14:28:21','0','0'); -- id=1168
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 ('00380', '11', '16', '380', '10', '1400', '14000.00', '0', '', '2026-09-20 14:33:50', '380','','','0','0','0','0','0',null,'1400','14000','0','0','0','0','0','0','0','0','1'); -- id=31
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-20 14:28:21', 1, 380, 0, 0
                    , 1400, 10, 0, 0, 1, '2026-09-20 14:33:52')
                ON DUPLICATE KEY UPDATE buyprice = 1400,
                        buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-20 14:33:52' ; -- id=31
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('380', '1400', '10', '0', 'buyBillController.php', '31', '', '0', '0'); -- id=31
UPDATE product SET  productBuyPrice = "1400" WHERE productId = 380 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 31 ;
UPDATE product SET productName = 'نجفه ليد موديل 3037 اسمر مستورد ', productDescription = '', productCatId = '16', productBuyPrice = '1400.00', productSellAllPrice = '1450.00', productSellUnitPrice = '1650.00', productSellHalfPrice = '1450.00', productDate = '2026-09-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00380',type ='0', expireDate = '0' , dailyentryId = '486',isService = '0',isOptic = '0',lastbuyprice = '1400',lastbuyprice_withDiscount = '1400',meanbuyprice = '1400',meanbuyprice_withDiscount = '1400' , productbuypricereal = '1400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.57' , buyhalf_precentage = '3.57' , buypart_precentage = '17.86',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1400',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='1400',meanbuyprice_withTax='1400',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='1400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '380';
UPDATE buybilldetail SET  lastbuyprice = 1400 , meanbuyprice = 1400, lastbuyprice_withDiscount = 1400, meanbuyprice_withDiscount = 1400
        , lastbuyprice_withTax = 1400, meanbuyprice_withTax = 1400, lastbuyprice_withDiscountAndTax = 1400
                where buybilldetailid = 31;
UPDATE productunit SET proUnitBuyPrice  = 1400 * productnumber WHERE productid = 380;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-09-20' WHERE storedetailid = '380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('380', '1', '10', '0', '11', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '10', '1', '2026-09-20 14:28:21','0','0'); -- id=1169
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 ('00378', '11', '16', '378', '20', '425', '8500.00', '0', '', '2026-09-20 14:33:50', '378','','','0','0','0','0','0',null,'425','8500','0','0','0','0','0','0','0','0','1'); -- id=32
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-20 14:28:21', 1, 378, 0, 0
                    , 425, 20, 0, 0, 1, '2026-09-20 14:33:53')
                ON DUPLICATE KEY UPDATE buyprice = 425,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-20 14:33:53' ; -- id=32
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('378', '425', '20', '0', 'buyBillController.php', '32', '', '0', '0'); -- id=32
UPDATE product SET  productBuyPrice = "425" WHERE productId = 378 ;
UPDATE buybilldetail SET  quantitybefore = 13 WHERE buybilldetailid = 32 ;
UPDATE product SET productName = 'ابليك موديل 2532 اسمر مستورد', productDescription = '', productCatId = '16', productBuyPrice = '425.00', productSellAllPrice = '450.00', productSellUnitPrice = '485.00', productSellHalfPrice = '450.00', productDate = '2026-09-17', conditions = '0', userId = '1', limitamount = '3', parcode = '00378',type ='0', expireDate = '0' , dailyentryId = '484',isService = '0',isOptic = '0',lastbuyprice = '425',lastbuyprice_withDiscount = '425',meanbuyprice = '425',meanbuyprice_withDiscount = '425' , productbuypricereal = '425.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.88' , buyhalf_precentage = '5.88' , buypart_precentage = '14.12',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='425',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='425',meanbuyprice_withTax='425',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='425',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '378';
UPDATE buybilldetail SET  lastbuyprice = 425 , meanbuyprice = 425, lastbuyprice_withDiscount = 425, meanbuyprice_withDiscount = 425
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where buybilldetailid = 32;
UPDATE productunit SET proUnitBuyPrice  = 425 * productnumber WHERE productid = 378;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-09-20' WHERE storedetailid = '378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('378', '1', '20', '0', '11', 'اضافة فاتورة مشتريات', 'buyBillController.php', '13', '33', '1', '2026-09-20 14:28:21','0','0'); -- id=1170
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 ('00426', '11', '16', '426', '2', '1750', '3500.00', '0', '', '2026-09-20 14:33:50', '426','','','0','0','0','0','0',null,'1750','3500','0','0','0','0','0','0','0','0','1'); -- id=33
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-20 14:28:21', 1, 426, 0, 0
                    , 1750, 2, 0, 0, 1, '2026-09-20 14:33:54')
                ON DUPLICATE KEY UPDATE buyprice = 1750,
                        buyQuantity =buyQuantity+2, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-20 14:33:54' ; -- id=33
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('426', '1750', '2', '0', 'buyBillController.php', '33', '', '0', '0'); -- id=33
UPDATE product SET  productBuyPrice = "1750" WHERE productId = 426 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 33 ;
UPDATE product SET productName = 'نجفه موديل k39 ثلاثي اسمر ', productDescription = '', productCatId = '16', productBuyPrice = '1750.00', productSellAllPrice = '1900.00', productSellUnitPrice = '1980.00', productSellHalfPrice = '1900.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '1', parcode = '00426',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1750',lastbuyprice_withDiscount = '1750',meanbuyprice = '1750',meanbuyprice_withDiscount = '1750' , productbuypricereal = '1750.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='1750',meanbuyprice_withTax='1750',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='1750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '426';
UPDATE buybilldetail SET  lastbuyprice = 1750 , meanbuyprice = 1750, lastbuyprice_withDiscount = 1750, meanbuyprice_withDiscount = 1750
        , lastbuyprice_withTax = 1750, meanbuyprice_withTax = 1750, lastbuyprice_withDiscountAndTax = 1750
                where buybilldetailid = 33;
UPDATE productunit SET proUnitBuyPrice  = 1750 * productnumber WHERE productid = 426;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-09-20' WHERE storedetailid = '426';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('426', '1', '2', '0', '11', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '2', '1', '2026-09-20 14:28:21','0','0'); -- id=1171
UPDATE supplier SET  suppliercurrentDebt = '53150',suppliercurrentDebtInCurrency= '53150' , userid = '1', supplierdate = '2026-09-20 14:33:50'   WHERE supplierid = '12';
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 ('12', '19950.00', '33200', '0', 'اضافة فاتورة مشتريات', '11', '53150', '2026-09-20 14:28:21', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','33200','1','19950','33200','53150','0',''); -- id=30
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '33200', '33200', '2026-09-20', '1', '0', '0', '2026-09-20 14:33:55','اضافة فاتورة مشتريات رقم 11','1','0',null,'0','11','buyBillController.php?do=details&id=11'); -- id=675
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('675', '382', '33200', '','0'); -- id=675
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2142682.61', 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 ('675', '446', '33200', '','0'); -- id=675
UPDATE accountstree SET name = 'سعيد صفوت ', customName = 'سعيد صفوت ', customNameEn = 'سعيد صفوت ', nameEn = 'سعيد صفوت ', parent = '81', accountNature = '1', theValue = '53150', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:29:51' WHERE id = '446';
update buybill set dailyentryid='675,0' where buybillid=11;
COMMIT;
UPDATE product SET overAllAveragePrice = 425 WHERE productId = 378;UPDATE product SET overAllAveragePrice = 1400 WHERE productId = 380;UPDATE product SET overAllAveragePrice = 1800 WHERE productId = 381;UPDATE product SET overAllAveragePrice = 1750 WHERE productId = 426;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:03:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:33:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-20 14:33:55', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=11'); -- id=1762
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:04:03";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:34:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-09-20 14:34:03', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php'); -- id=1763
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:04:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:34:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-09-20 14:34:15', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=1764
BEGIN;
CALL supplierInUse(12,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('12', '53150.00', '35650', '1', 'ايصال دفع لمورد', '1', '17500', '2026-09-20 14:34:04', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','35650','1','0','0','0','9',''); -- id=31
UPDATE supplierdebtchange SET supplierid = '12', supplierdebtchangebefore = '53150.00', supplierdebtchangeamount = '35650', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '17500', supplierdebtchangedate = '2026-09-20 14:34:04', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='35650',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='53150',debtchangamountInSupplierCurrency='35650',debtchangafterInSupplierCurrency='17500', paySerialNo='9',tagids='' WHERE supplierdebtchangeid = '31';
UPDATE supplier SET  suppliercurrentDebt = '17500',suppliercurrentDebtInCurrency= '17500' , userid = '1', supplierdate = '2026-09-20 14:34:15'   WHERE supplierid = '12';
UPDATE supplier SET  inUse = 0 where supplierid = 12;
UPDATE save SET  savecurrentvalue = '-215562.98',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-179912.98','35650', '1', '1', 'ايصال دفع لمورد', '31', '-215562.98', '2026-09-20 14:34:15', '1',  'supplierPayedDeptController.php','0','','0'); -- id=70
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '35650', '35650', '2026-09-20', '1', '0', '0', '2026-09-20 14:34:16','ايصال دفع لمورد ( سعيد صفوت  ) ','1','0','0','0','31','supplierReportsController.php?do=show&id=31'); -- id=676
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('676', '446', '35650', '','0'); -- id=676
UPDATE accountstree SET name = 'سعيد صفوت ', customName = 'سعيد صفوت ', customNameEn = 'سعيد صفوت ', nameEn = 'سعيد صفوت ', parent = '81', accountNature = '1', theValue = '17500', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 14:29:51' WHERE id = '446';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('676', '383', '35650', '','0'); -- id=676
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-168870.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '12', supplierdebtchangebefore = '53150.00', supplierdebtchangeamount = '35650.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '17500.00', supplierdebtchangedate = '2026-09-20 14:34:04', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '676',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='35650',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='53150',debtchangamountInSupplierCurrency='35650',debtchangafterInSupplierCurrency='17500', paySerialNo='9',tagids='' WHERE supplierdebtchangeid = '31';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:04:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:34:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-09-20 14:34:17', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=1765
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:04:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:34:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-09-20 14:34:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=1766
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:04:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:34:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-20 14:34:19', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php'); -- id=1767
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:04:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:34:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 14:34:23', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=1768
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:04:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:34:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 14:34:27', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1769
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:09:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 14:39:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 14:39:50', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1770
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('محمد السعيد صالح ' , '', '', '', '0', '', '0', '2026-09-20 14:42:26', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=18
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('18', '0', '0', '', ''); -- id=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','0','0','0','إضافة عميل جديد','18', '0', '2026-09-20 14:42:26', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=115
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-20 14:42:27'); -- id=447
UPDATE client SET clientname = 'محمد السعيد صالح ', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='447',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 = '18';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:36:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 15:06:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 15:06:49', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1771

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafd416c1443
-- ----------------------------------------------------------------------------------------------------

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,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-20 15:06:49', '06aafd416c1443', '18', '0.00', '520', '0', '1', '10520.00', '10520', '10000', '520', '1', '2026-09-20 15:06:49', '', '1', '0', 'محمد السعيد صالح ', '1', '1', '3', '0', 'محمد السعيد صالح ', '322' ,'0','','','','','-1','0','0','0','0','0','10520','0','','0','0','10000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=73
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','0.00','520','0','اضافة فاتورة مبيعات','73', '520', '2026-09-20 15:06:50', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10520', '0', null, '0', null, null,'', '0','1','1','520','1','2026-09-20 15:06:49','0','0','',''); -- id=116
UPDATE client SET  inUse = 0 where clientid = 18;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','00175', '73', '19', '175', '6', '330', '1980', '0', '', '1', '2026-09-20 15:06:50', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','330','1980','0','','0','0.00','0','0','0','0'); -- id=472
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 472;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-09-20', 1980, 1950, 1950
                    , 1950, 1950, 1950, 1950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1980, 1950, 1950
                    , 1950, 1950, 1950, 1950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:50' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '6', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '44', '1', '2026-09-20 15:06:50','0','0'); -- id=1172
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','00174', '73', '19', '174', '9', '275', '2475', '0', '', '1', '2026-09-20 15:06:50', '174', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','275','2475','0','','0','0.00','0','0','0','0'); -- id=473
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 473;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (174, '2026-09-20', 2475, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2475, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 2475, 2430, 2430
                    , 2430, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2430, 2430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2475, sellCostBuyPrice =sellCostBuyPrice+2430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:51' WHERE storedetailid = '174';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('174', '1', '9', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '11', '1', '2026-09-20 15:06:51','0','0'); -- id=1173
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00190', '73', '20', '190', '5', '15', '75', '0', '', '1', '2026-09-20 15:06:51', '190', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','75','0','','0','0.00','0','0','0','0'); -- id=474
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 = 474;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (190, '2026-09-20', 75, 65, 65
                    , 65, 65, 65, 65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 65, 65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 75, 65, 65
                    , 65, 65, 65, 65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '253', userid = '1', storedetaildate = '2026-09-20 15:06:51' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '5', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '258', '253', '1', '2026-09-20 15:06:51','0','0'); -- id=1174
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.77','00347', '73', '3', '347', '2', '31', '62', '0', '', '1', '2026-09-20 15:06:51', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-2,','1','1','0','0','31','62','0','','0','0.00','0','0','0','0'); -- id=475
UPDATE sellbilldetail SET  lastbuyprice = 29.77 , meanbuyprice = 29.77, lastbuyprice_withDiscount = 29.77, meanbuyprice_withDiscount = 29.77
        , lastbuyprice_withTax = 29.77, meanbuyprice_withTax = 29.77, lastbuyprice_withDiscountAndTax = 29.77
                where sellbilldetailid = 475;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (347, '2026-09-20', 62, 59.54, 59.54
                    , 59.54, 59.54, 59.54, 59.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 59.54, 59.54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+62, sellCostBuyPrice =sellCostBuyPrice+59.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59.54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59.54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59.54
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 62, 59.54, 59.54
                    , 59.54, 59.54, 59.54, 59.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 59.54, 59.54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+62, sellCostBuyPrice =sellCostBuyPrice+59.54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+59.54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+59.54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+59.54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+59.54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+59.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+59.54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+59.54
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:51' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '2', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '30', '1', '2026-09-20 15:06:51','0','0'); -- id=1175
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00297', '73', '6', '297', '1', '40', '40', '0', '', '1', '2026-09-20 15:06:51', '297', '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=476
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 = 476;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (297, '2026-09-20', 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-20', 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 = '16', userid = '1', storedetaildate = '2026-09-20 15:06:52' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '1', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17', '16', '1', '2026-09-20 15:06:52','0','0'); -- id=1176
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+75 where id = 11;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '73', '3', '102', '75', '12', '900', '0', '', '1', '2026-09-20 15:06:52', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-75,','1','1','0','0','12','900','0','','0','0.00','0','0','0','0'); -- id=477
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 477;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-09-20', 900, 881.25, 881.25
                    , 881.25, 881.25, 881.25, 881.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 881.25, 881.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+881.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+881.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+881.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+881.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+881.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+881.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+881.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+881.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+75
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 900, 881.25, 881.25
                    , 881.25, 881.25, 881.25, 881.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 881.25, 881.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+881.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+881.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+881.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+881.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+881.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+881.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+881.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+881.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1273', userid = '1', storedetaildate = '2026-09-20 15:06:52' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '75', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1348', '1273', '1', '2026-09-20 15:06:52','0','0'); -- id=1177
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+120 where id = 8;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.5','00103', '73', '3', '103', '120', '5.5', '660', '0', '', '1', '2026-09-20 15:06:52', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-120,','1','1','0','0','5.5','660','0','','0','0.00','0','0','0','0'); -- id=478
UPDATE sellbilldetail SET  lastbuyprice = 4.50 , meanbuyprice = 4.50, lastbuyprice_withDiscount = 4.50, meanbuyprice_withDiscount = 4.50
        , lastbuyprice_withTax = 4.5, meanbuyprice_withTax = 4.5, lastbuyprice_withDiscountAndTax = 4.5
                where sellbilldetailid = 478;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-09-20', 660, 540, 540
                    , 540, 540, 540, 540
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 0, 540, 540, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+540
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+540, sellCostMeanBuyPrice = sellCostMeanBuyPrice+540
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+540, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+540
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+540
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+540
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+540
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+120
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 660, 540, 540
                    , 540, 540, 540, 540
                    , 0, 0, 0, 0
                    , 0, 0, 0, 540, 540, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+540
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+540, sellCostMeanBuyPrice = sellCostMeanBuyPrice+540
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+540, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+540
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+540
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+540
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+540
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1945', userid = '1', storedetaildate = '2026-09-20 15:06:52' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '120', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2065', '1945', '1', '2026-09-20 15:06:52','0','0'); -- id=1178
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('37','00117', '73', '3', '117', '8', '39', '312', '0', '', '1', '2026-09-20 15:06:52', '117', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','312','0','','0','0.00','0','0','0','0'); -- id=479
UPDATE sellbilldetail SET  lastbuyprice = 37.00 , meanbuyprice = 37.00, lastbuyprice_withDiscount = 37.00, meanbuyprice_withDiscount = 37.00
        , lastbuyprice_withTax = 37, meanbuyprice_withTax = 37, lastbuyprice_withDiscountAndTax = 37
                where sellbilldetailid = 479;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (117, '2026-09-20', 312, 296, 296
                    , 296, 296, 296, 296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 296, 296, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312, sellCostBuyPrice =sellCostBuyPrice+296
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+296, sellCostMeanBuyPrice = sellCostMeanBuyPrice+296
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+296
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+296
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 312, 296, 296
                    , 296, 296, 296, 296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 296, 296, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312, sellCostBuyPrice =sellCostBuyPrice+296
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+296, sellCostMeanBuyPrice = sellCostMeanBuyPrice+296
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+296
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+296
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:53' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '8', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '27', '1', '2026-09-20 15:06:53','0','0'); -- id=1179
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+30 where id = 13;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '73', '3', '100', '30', '17.75', '532.5', '0', '', '1', '2026-09-20 15:06:53', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','13-30,','1','1','0','0','17.75','532.5','0','','0','0.00','0','0','0','0'); -- id=480
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 480;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-09-20', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '336', userid = '1', storedetaildate = '2026-09-20 15:06:53' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '30', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '366', '336', '1', '2026-09-20 15:06:53','0','0'); -- id=1180
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00101', '73', '3', '101', '30', '17.75', '532.5', '0', '', '1', '2026-09-20 15:06:53', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','17.75','532.5','0','','0','0.00','0','0','0','0'); -- id=481
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 481;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-09-20', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 532.5, 528, 528
                    , 528, 528, 528, 528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 528, 528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+532.5, sellCostBuyPrice =sellCostBuyPrice+528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '390', userid = '1', storedetaildate = '2026-09-20 15:06:53' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '30', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '420', '390', '1', '2026-09-20 15:06:53','0','0'); -- id=1181
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('53','00116', '73', '3', '116', '10', '56', '560', '0', '', '1', '2026-09-20 15:06:53', '116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','56','560','0','','0','0.00','0','0','0','0'); -- id=482
UPDATE sellbilldetail SET  lastbuyprice = 53.00 , meanbuyprice = 53.00, lastbuyprice_withDiscount = 53.00, meanbuyprice_withDiscount = 53.00
        , lastbuyprice_withTax = 53, meanbuyprice_withTax = 53, lastbuyprice_withDiscountAndTax = 53
                where sellbilldetailid = 482;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (116, '2026-09-20', 560, 530, 530
                    , 530, 530, 530, 530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 530, 530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+560, sellCostBuyPrice =sellCostBuyPrice+530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+530
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 560, 530, 530
                    , 530, 530, 530, 530
                    , 0, 0, 0, 0
                    , 0, 0, 0, 530, 530, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+560, sellCostBuyPrice =sellCostBuyPrice+530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+530
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+530
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+530
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+530
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-09-20 15:06:54' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '10', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '9', '1', '2026-09-20 15:06:54','0','0'); -- id=1182
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('88','00115', '73', '3', '115', '2', '90.5', '181', '0', '', '1', '2026-09-20 15:06:54', '115', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','90.5','181','0','','0','0.00','0','0','0','0'); -- id=483
UPDATE sellbilldetail SET  lastbuyprice = 88.00 , meanbuyprice = 88.00, lastbuyprice_withDiscount = 88.00, meanbuyprice_withDiscount = 88.00
        , lastbuyprice_withTax = 88, meanbuyprice_withTax = 88, lastbuyprice_withDiscountAndTax = 88
                where sellbilldetailid = 483;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (115, '2026-09-20', 181, 176, 176
                    , 176, 176, 176, 176
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 176, 176, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181, sellCostBuyPrice =sellCostBuyPrice+176
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+176, sellCostMeanBuyPrice = sellCostMeanBuyPrice+176
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+176, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+176
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+176
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+176
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+176
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 181, 176, 176
                    , 176, 176, 176, 176
                    , 0, 0, 0, 0
                    , 0, 0, 0, 176, 176, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+181, sellCostBuyPrice =sellCostBuyPrice+176
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+176, sellCostMeanBuyPrice = sellCostMeanBuyPrice+176
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+176, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+176
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+176
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+176
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+176
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:54' WHERE storedetailid = '115';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('115', '1', '2', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '37', '1', '2026-09-20 15:06:54','0','0'); -- id=1183
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '73', '14', '81', '4', '19', '76', '0', '', '1', '2026-09-20 15:06:54', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','76','0','','0','0.00','0','0','0','0'); -- id=484
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 = 484;
 INSERT INTO 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-20', 76, 72, 72
                    , 72, 72, 72, 72
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 72, 72, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+76, sellCostBuyPrice =sellCostBuyPrice+72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+72
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 76, 72, 72
                    , 72, 72, 72, 72
                    , 0, 0, 0, 0
                    , 0, 0, 0, 72, 72, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+76, sellCostBuyPrice =sellCostBuyPrice+72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+72
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '622', userid = '1', storedetaildate = '2026-09-20 15:06:54' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '4', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '626', '622', '1', '2026-09-20 15:06:54','0','0'); -- id=1184
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 22;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('78.4','00386', '73', '3', '386', '2', '82.5', '165', '0', '', '1', '2026-09-20 15:06:54', '386', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','22-2,','1','1','0','0','82.5','165','0','','0','0.00','0','0','0','0'); -- id=485
UPDATE sellbilldetail SET  lastbuyprice = 78.40 , meanbuyprice = 78.40, lastbuyprice_withDiscount = 78.40, meanbuyprice_withDiscount = 78.40
        , lastbuyprice_withTax = 78.4, meanbuyprice_withTax = 78.4, lastbuyprice_withDiscountAndTax = 78.4
                where sellbilldetailid = 485;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (386, '2026-09-20', 165, 156.8, 156.8
                    , 156.8, 156.8, 156.8, 156.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 156.8, 156.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+156.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+156.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+156.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+156.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+156.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+156.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+156.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+156.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-20', 165, 156.8, 156.8
                    , 156.8, 156.8, 156.8, 156.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 156.8, 156.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+156.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+156.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+156.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+156.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+156.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+156.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+156.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+156.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 = '42', userid = '1', storedetaildate = '2026-09-20 15:06:55' WHERE storedetailid = '386';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '1', '2', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '42', '1', '2026-09-20 15:06:55','0','0'); -- id=1185
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('95','00342', '73', '6', '342', '2', '135', '270', '0', '', '1', '2026-09-20 15:06:55', '342', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','135','270','0','','0','0.00','0','0','0','0'); -- id=486
UPDATE sellbilldetail SET  lastbuyprice = 95.00 , meanbuyprice = 95.00, lastbuyprice_withDiscount = 95.00, meanbuyprice_withDiscount = 95.00
        , lastbuyprice_withTax = 95, meanbuyprice_withTax = 95, lastbuyprice_withDiscountAndTax = 95
                where sellbilldetailid = 486;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (342, '2026-09-20', 270, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 270, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+270, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:55' WHERE storedetailid = '342';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('342', '1', '2', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '1', '1', '2026-09-20 15:06:55','0','0'); -- id=1186
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '73', '3', '111', '3', '120', '360', '0', '', '1', '2026-09-20 15:06:55', '111', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','120','360','0','','0','0.00','0','0','0','0'); -- id=487
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 = 487;
 INSERT INTO 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-20', 360, 348, 348
                    , 348, 348, 348, 348
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 348, 348, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+348
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+348
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+348
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+348
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 360, 348, 348
                    , 348, 348, 348, 348
                    , 0, 0, 0, 0
                    , 0, 0, 0, 348, 348, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+348
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+348
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+348
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+348
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:55' WHERE storedetailid = '111';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('111', '1', '3', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '31', '28', '1', '2026-09-20 15:06:55','0','0'); -- id=1187
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00109', '73', '3', '109', '3', '103', '309', '0', '', '1', '2026-09-20 15:06:56', '109', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','103','309','0','','0','0.00','0','0','0','0'); -- id=488
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 = 488;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (109, '2026-09-20', 309, 303, 303
                    , 303, 303, 303, 303
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 303, 303, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+309, sellCostBuyPrice =sellCostBuyPrice+303
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+303, sellCostMeanBuyPrice = sellCostMeanBuyPrice+303
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+303, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+303
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+303
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+303
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+303
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 309, 303, 303
                    , 303, 303, 303, 303
                    , 0, 0, 0, 0
                    , 0, 0, 0, 303, 303, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+309, sellCostBuyPrice =sellCostBuyPrice+303
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+303, sellCostMeanBuyPrice = sellCostMeanBuyPrice+303
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+303, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+303
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+303
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+303
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+303
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-09-20 15:06:56' WHERE storedetailid = '109';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '1', '3', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '33', '1', '2026-09-20 15:06:56','0','0'); -- id=1188
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '73', '3', '108', '10', '103', '1030', '0', '', '1', '2026-09-20 15:06:56', '108', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','24-10,','1','1','0','0','103','1030','0','','0','0.00','0','0','0','0'); -- id=489
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 = 489;
 INSERT INTO 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-20', 1030, 1010, 1010
                    , 1010, 1010, 1010, 1010
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 1010, 1010, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1030, sellCostBuyPrice =sellCostBuyPrice+1010
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1010, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1010
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1010, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1010
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1010
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1010
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1010
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1030, 1010, 1010
                    , 1010, 1010, 1010, 1010
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1010, 1010, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1030, sellCostBuyPrice =sellCostBuyPrice+1010
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1010, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1010
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1010, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1010
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1010
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1010
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1010
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 15:06:56' WHERE storedetailid = '108';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('108', '1', '10', '1', '73', 'اضافة فاتورة مبيعات', 'sellbillController.php', '47', '37', '1', '2026-09-20 15:06:56','0','0'); -- id=1189
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-205562.984375',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-215562.984375','10000', '0', '1', 'اضافة فاتورة مبيعات', '73', '-205562.984375', '2026-09-20 15:06:56', '1',  'sellbillController.php','18','','0'); -- id=71
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10520', '10520', '2026-09-20', '1', '0', '0', '2026-09-20 15:06:56','اضافة فاتورة مبيعات رقم 73','1','0',null,'0','73','sellbillController.php?do=showDetail&sellbillid=73'); -- id=677
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('677', '447', '10520', '','0'); -- id=677
UPDATE accountstree SET name = 'محمد السعيد صالح ', customName = 'محمد السعيد صالح ', customNameEn = 'محمد السعيد صالح ', nameEn = 'محمد السعيد صالح ', parent = '58', accountNature = '0', theValue = '10520', 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 ('677', '143', '10520', '','0'); -- id=677
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '226124.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10000', '10000', '2026-09-20', '1', '0', '0', '2026-09-20 15:06:56','اضافة فاتورة مبيعات رقم 73 - تحصيل الفاتورة من العميل','1','0',null,'0','73','sellbillController.php?do=showDetail&sellbillid=73'); -- id=678
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('678', '383', '10000', '','0'); -- id=678
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-158870.98', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('678', '447', '10000', '','0'); -- id=678
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 dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10098.59', '10098.59', '2026-09-20', '1', '0', '0', '2026-09-20 15:06:56','اضافة فاتورة مبيعات رقم 73 - صرف البضاعة من المخزن','1','0',null,'0','73','sellbillController.php?do=showDetail&sellbillid=73'); -- id=679
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('679', '402', '10098.59', '','0'); -- id=679
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '211760.05', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('679', '382', '10098.59', '','0'); -- id=679
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2132584.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='677,678,679' where sellbillid=73;
 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-20', 10520, 10098.59, 10098.59
                    , 10098.59, 10098.59, 10098.59, 10098.59
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10098.59, 10098.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10520, sellCostBuyPrice =sellCostBuyPrice+10098.59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10098.59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10098.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10098.59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10098.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10098.59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10098.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10098.59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (18, '2026-09-20', 10520, 10098.59, 10098.59
                    , 10098.59, 10098.59, 10098.59, 10098.59
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10098.59, 10098.59, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10520, sellCostBuyPrice =sellCostBuyPrice+10098.59
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10098.59, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10098.59
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10098.59, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10098.59
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10098.59
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10098.59
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10098.59
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 10520, 10098.59, 10098.59
                    , 10098.59, 10098.59, 10098.59, 10098.59, 10098.59, 10098.59)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10520, netSellCostBuyPrice = netSellCostBuyPrice+10098.59
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10098.59
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10098.59
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10098.59
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10098.59
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10098.59
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10098.59
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10098.59;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafd416c1443 and sellbillId = 73 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 11:36:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 15:06:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 15:06:59', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1772
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:01:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 15:31:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 15:31:46', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1773
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('ايمن صلاح' , '', '', '', '0', '', '0', '2026-09-20 15:32:06', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=19
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('19', '0', '0', '', ''); -- id=19
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 ('19','0','0','0','إضافة عميل جديد','19', '0', '2026-09-20 15:32:06', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=117
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-20 15:32:07'); -- id=448
UPDATE client SET clientname = 'ايمن صلاح', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='448',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 = '19';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:29:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 15:59:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 15:59:59', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1774
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:30:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:00:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:00:02', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1775
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:30:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:00:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:00:21', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1776
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:31:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:01:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:01:06', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1777
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 ('باور سبلاي 100 وات ماجنتيك ','','8','137','185','225','185','2026-09-20','0','1','0','','0','0','0','0','0','137','137','137','137','137','0','35.04','35.04','64.23','.','0','0','0','137','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','137','137','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','137','0','0','0','0','0','0','','','0','0','0','0'); -- id=427
UPDATE product SET productName = 'باور سبلاي 100 وات ماجنتيك ', productDescription = '', productCatId = '8', productBuyPrice = '137', productSellAllPrice = '185', productSellUnitPrice = '225', productSellHalfPrice = '185', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00427',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '137',lastbuyprice_withDiscount = '137',meanbuyprice = '137',meanbuyprice_withDiscount = '137' , productbuypricereal = '137' , buypricereal_precentage = '0' , buytotal_precentage = '35.04' , buyhalf_precentage = '35.04' , buypart_precentage = '64.23',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='137',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='137',meanbuyprice_withTax='137',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='137',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '427';
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', '427', '1.00', '2026-09-20', '1', '0','0042701','185','185','225','137','','0','0','0','0','0','0','0','0','0','0'); -- id=427
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('427', '1', '50', '1', '2026-09-20'); -- id=427
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('427', '1', '50', '0', '427', 'إضافة منتج', 'productController.php', '0', '50', '1', '2026-09-20','0','0'); -- id=1190
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (427, 1,'2026-09-20 16:01:08',1)
                ON DUPLICATE KEY UPDATE productid = 427, edited = 1, sysdate = '2026-09-20 16:01:08', userid = 1; -- id=531
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6850', '6850', '2026-09-20', '1', '0', '0', '2026-09-20 16:01:08','إضافة منتج باور سبلاي 100 وات ماجنتيك  الكمية 50','1','0','0','0','427','productController.php?do=edit&id=427'); -- id=680
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('680', '382', '6850', '','0'); -- id=680
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2139434.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 ('680', '121', '6850', '','0'); -- id=680
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1163587.37', 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 = 'باور سبلاي 100 وات ماجنتيك ', productDescription = '', productCatId = '8', productBuyPrice = '137.00', productSellAllPrice = '185.00', productSellUnitPrice = '225.00', productSellHalfPrice = '185.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00427',type ='0', expireDate = '0' , dailyentryId = '680',isService = '0',isOptic = '0',lastbuyprice = '137',lastbuyprice_withDiscount = '137',meanbuyprice = '137',meanbuyprice_withDiscount = '137' , productbuypricereal = '137' , buypricereal_precentage = '0' , buytotal_precentage = '35.04' , buyhalf_precentage = '35.04' , buypart_precentage = '64.23',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='137',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='137',meanbuyprice_withTax='137',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='137',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '427';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:31:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:01:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:01:10', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1778
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:31:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:01:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:01:12', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1779
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:31:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:01:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:01:25', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=1780
UPDATE productunit SET proUnitBuyPrice  = 275 * productnumber WHERE productid = 283;
UPDATE product SET productName = 'باور سبلاي ماجنتيك 200', productDescription = '', productCatId = '22', productBuyPrice = '275', productSellAllPrice = '295.00', productSellUnitPrice = '335.00', productSellHalfPrice = '295.00', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00283',type ='0', expireDate = '0' , dailyentryId = '334',isService = '0',isOptic = '0',lastbuyprice = '275.00',lastbuyprice_withDiscount = '275',meanbuyprice = '275.00',meanbuyprice_withDiscount = '275' , productbuypricereal = '275.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.27' , buyhalf_precentage = '7.27' , buypart_precentage = '21.82',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='275',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='275',meanbuyprice_withTax='275',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='275',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '283';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (283, 1,'2026-09-20 16:01:46',1)
                ON DUPLICATE KEY UPDATE productid = 283, edited = 1, sysdate = '2026-09-20 16:01:46', userid = 1; -- id=300
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:31:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:01:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:01:50', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1781
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:32:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:02:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:02:16', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1782
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 ('باور سبلاي 200 وات ماجنتيك ','','8','250','295','350','295','2026-09-20','0','1','0','','0','0','0','0','0','250','250','250','250','250','0','18','18','40','.','0','0','0','250','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','250','250','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','250','0','0','0','0','0','0','','','0','0','0','0'); -- id=428
UPDATE product SET productName = 'باور سبلاي 200 وات ماجنتيك ', productDescription = '', productCatId = '8', productBuyPrice = '250', productSellAllPrice = '295', productSellUnitPrice = '350', productSellHalfPrice = '295', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00428',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '250',lastbuyprice_withDiscount = '250',meanbuyprice = '250',meanbuyprice_withDiscount = '250' , productbuypricereal = '250' , buypricereal_precentage = '0' , buytotal_precentage = '18' , buyhalf_precentage = '18' , buypart_precentage = '40',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='250',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='250',meanbuyprice_withTax='250',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='250',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '428';
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', '428', '1.00', '2026-09-20', '1', '0','0042801','295','295','350','250','','0','0','0','0','0','0','0','0','0','0'); -- id=428
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('428', '1', '50', '1', '2026-09-20'); -- id=428
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '50', '0', '428', 'إضافة منتج', 'productController.php', '0', '50', '1', '2026-09-20','0','0'); -- id=1191
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (428, 1,'2026-09-20 16:02:17',1)
                ON DUPLICATE KEY UPDATE productid = 428, edited = 1, sysdate = '2026-09-20 16:02:17', userid = 1; -- id=533
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '12500', '12500', '2026-09-20', '1', '0', '0', '2026-09-20 16:02:17','إضافة منتج باور سبلاي 200 وات ماجنتيك  الكمية 50','1','0','0','0','428','productController.php?do=edit&id=428'); -- id=681
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('681', '382', '12500', '','0'); -- id=681
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2151934.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 ('681', '121', '12500', '','0'); -- id=681
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1176087.37', 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 = 'باور سبلاي 200 وات ماجنتيك ', productDescription = '', productCatId = '8', productBuyPrice = '250.00', productSellAllPrice = '295.00', productSellUnitPrice = '350.00', productSellHalfPrice = '295.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00428',type ='0', expireDate = '0' , dailyentryId = '681',isService = '0',isOptic = '0',lastbuyprice = '250',lastbuyprice_withDiscount = '250',meanbuyprice = '250',meanbuyprice_withDiscount = '250' , productbuypricereal = '250' , buypricereal_precentage = '0' , buytotal_precentage = '18' , buyhalf_precentage = '18' , buypart_precentage = '40',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='250',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='250',meanbuyprice_withTax='250',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='250',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '428';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:32:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:02:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:02:20', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1783
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:32:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:02:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:02:48', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1784
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:39:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:09:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:09:16', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1785
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('مرتضي كفر شرف' , '', '', '', '0', '', '0', '2026-09-20 16:13:38', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=20
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('20', '0', '0', '', ''); -- id=20
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('20','0','0','0','إضافة عميل جديد','20', '0', '2026-09-20 16:13:38', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=118
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-20 16:13:39'); -- id=449
UPDATE client SET clientname = 'مرتضي كفر شرف', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='449',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 = '20';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:44:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:14:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:14:28', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1786
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:46:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:16:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:16:19', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1787
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 ('متر سلك مجدول 1 ملي الشرق','','10','4','6','6','6','2026-09-20','0','1','0','','0','0','0','0','0','4','4','4','4','4','0','50','50','50','.','0','0','0','4','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','4','4','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','4','0','0','0','0','0','0','','','0','0','0','0'); -- id=429
UPDATE product SET productName = 'متر سلك مجدول 1 ملي الشرق', productDescription = '', productCatId = '10', productBuyPrice = '4', productSellAllPrice = '6', productSellUnitPrice = '6', productSellHalfPrice = '6', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00429',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '4',lastbuyprice_withDiscount = '4',meanbuyprice = '4',meanbuyprice_withDiscount = '4' , productbuypricereal = '4' , buypricereal_precentage = '0' , buytotal_precentage = '50' , buyhalf_precentage = '50' , buypart_precentage = '50',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='4',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='4',meanbuyprice_withTax='4',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='4',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '429';
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', '429', '1.00', '2026-09-20', '1', '0','0042901','6','6','6','4','','0','0','0','0','0','0','0','0','0','0'); -- id=429
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('429', '1', '60', '1', '2026-09-20'); -- id=429
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('429', '1', '60', '0', '429', 'إضافة منتج', 'productController.php', '0', '60', '1', '2026-09-20','0','0'); -- id=1192
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (429, 1,'2026-09-20 16:16:20',1)
                ON DUPLICATE KEY UPDATE productid = 429, edited = 1, sysdate = '2026-09-20 16:16:20', userid = 1; -- id=534
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '240', '240', '2026-09-20', '1', '0', '0', '2026-09-20 16:16:20','إضافة منتج متر سلك مجدول 1 ملي الشرق الكمية 60','1','0','0','0','429','productController.php?do=edit&id=429'); -- id=682
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('682', '382', '240', '','0'); -- id=682
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2152174.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 ('682', '121', '240', '','0'); -- id=682
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1176327.37', 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 = 'متر سلك مجدول 1 ملي الشرق', productDescription = '', productCatId = '10', productBuyPrice = '4.00', productSellAllPrice = '6.00', productSellUnitPrice = '6.00', productSellHalfPrice = '6.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00429',type ='0', expireDate = '0' , dailyentryId = '682',isService = '0',isOptic = '0',lastbuyprice = '4',lastbuyprice_withDiscount = '4',meanbuyprice = '4',meanbuyprice_withDiscount = '4' , productbuypricereal = '4' , buypricereal_precentage = '0' , buytotal_precentage = '50' , buyhalf_precentage = '50' , buypart_precentage = '50',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='4',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='4',meanbuyprice_withTax='4',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='4',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '429';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:46:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:16:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 16:16:23', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1788
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:46:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:16:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:16:52', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1789

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafe90cee946
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(20,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,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-20 16:16:53', '06aafe90cee946', '20', '0.00', '775', '0', '1', '775.00', '775', '0', '775', '1', '2026-09-20 16:16:53', '', '1', '0', 'مرتضي كفر شرف', '1', '1', '3', '0', 'مرتضي كفر شرف', '43' ,'0','','','','','-1','0','0','0','0','0','775','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=74
UPDATE client SET  clientdebt = '775', userid = '1' WHERE clientid = '20';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('20','0.00','775','0','اضافة فاتورة مبيعات','74', '775', '2026-09-20 16:16:54', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '775', '0', null, '0', null, null,'', '0','1','1','775','1','2026-09-20 16:16:53','0','0','',''); -- id=119
UPDATE client SET  inUse = 0 where clientid = 20;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 26;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21.5','00168', '74', '2', '168', '20', '30', '600', '0', '', '1', '2026-09-20 16:16:54', '168', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','26-20,','1','1','0','0','30','600','0','','0','','0','0','0','0'); -- id=490
UPDATE sellbilldetail SET  lastbuyprice = 21.50 , meanbuyprice = 21.50, lastbuyprice_withDiscount = 21.50, meanbuyprice_withDiscount = 21.50
        , lastbuyprice_withTax = 21.5, meanbuyprice_withTax = 21.5, lastbuyprice_withDiscountAndTax = 21.5
                where sellbilldetailid = 490;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (168, '2026-09-20', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 600, 430, 430
                    , 430, 430, 430, 430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 430, 430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '318', userid = '1', storedetaildate = '2026-09-20 16:16:54' WHERE storedetailid = '168';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('168', '1', '20', '1', '74', 'اضافة فاتورة مبيعات', 'sellbillController.php', '338', '318', '1', '2026-09-20 16:16:54','0','0'); -- id=1193
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '74', '14', '81', '1', '19', '19', '0', '', '1', '2026-09-20 16:16:54', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','19','0','','0','0.00','0','0','0','0'); -- id=491
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 = 491;
 INSERT INTO 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-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '621', userid = '1', storedetaildate = '2026-09-20 16:16:54' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '74', 'اضافة فاتورة مبيعات', 'sellbillController.php', '622', '621', '1', '2026-09-20 16:16:54','0','0'); -- id=1194
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('16','00239', '74', '2', '239', '2', '18', '36', '0', '', '1', '2026-09-20 16:16:55', '239', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','18','36','0','','0','0.00','0','0','0','0'); -- id=492
UPDATE sellbilldetail SET  lastbuyprice = 16.00 , meanbuyprice = 16.00, lastbuyprice_withDiscount = 16.00, meanbuyprice_withDiscount = 16.00
        , lastbuyprice_withTax = 16, meanbuyprice_withTax = 16, lastbuyprice_withDiscountAndTax = 16
                where sellbilldetailid = 492;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (239, '2026-09-20', 36, 32, 32
                    , 32, 32, 32, 32
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 32, 32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+32
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+32, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+32
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 36, 32, 32
                    , 32, 32, 32, 32
                    , 0, 0, 0, 0
                    , 0, 0, 0, 32, 32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+32
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+32, sellCostMeanBuyPrice = sellCostMeanBuyPrice+32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+32, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+32
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+32
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '198', userid = '1', storedetaildate = '2026-09-20 16:16:55' WHERE storedetailid = '239';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('239', '1', '2', '1', '74', 'اضافة فاتورة مبيعات', 'sellbillController.php', '200', '198', '1', '2026-09-20 16:16:55','0','0'); -- id=1195
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4','00429', '74', '10', '429', '20', '6', '120', '0', '', '1', '2026-09-20 16:16:55', '429', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6','120','0','','0','0.00','0','0','0','0'); -- id=493
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.00, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.00
        , lastbuyprice_withTax = 4, meanbuyprice_withTax = 4, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 493;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (429, '2026-09-20', 120, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 120, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-09-20 16:16:55' WHERE storedetailid = '429';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('429', '1', '20', '1', '74', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '40', '1', '2026-09-20 16:16:55','0','0'); -- id=1196
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '775', '775', '2026-09-20', '1', '0', '0', '2026-09-20 16:16:55','اضافة فاتورة مبيعات رقم 74','1','0',null,'0','74','sellbillController.php?do=showDetail&sellbillid=74'); -- id=683
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('683', '449', '775', '','0'); -- id=683
UPDATE accountstree SET name = 'مرتضي كفر شرف', customName = 'مرتضي كفر شرف', customNameEn = 'مرتضي كفر شرف', nameEn = 'مرتضي كفر شرف', parent = '58', accountNature = '0', theValue = '775', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 16:13:39' WHERE id = '449';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('683', '143', '775', '','0'); -- id=683
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '226899.84', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '560', '560', '2026-09-20', '1', '0', '0', '2026-09-20 16:16:55','اضافة فاتورة مبيعات رقم 74 - صرف البضاعة من المخزن','1','0',null,'0','74','sellbillController.php?do=showDetail&sellbillid=74'); -- id=684
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('684', '402', '560', '','0'); -- id=684
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '212320.05', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('684', '382', '560', '','0'); -- id=684
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2151614.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='683,0,684' where sellbillid=74;
 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-20', 775, 560, 560
                    , 560, 560, 560, 560
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,560, 560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+775, sellCostBuyPrice =sellCostBuyPrice+560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (20, '2026-09-20', 775, 560, 560
                    , 560, 560, 560, 560
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,560, 560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+775, sellCostBuyPrice =sellCostBuyPrice+560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+560
                        , returnSellVal = returnSellVal+0, 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, 775, 560, 560
                    , 560, 560, 560, 560, 560, 560)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+775, netSellCostBuyPrice = netSellCostBuyPrice+560
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+560
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+560
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+560
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+560
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+560
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+560
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+560;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafe90cee946 and sellbillId = 74 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 12:46:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:16:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:16:57', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1790
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 13:16:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:46:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:46:26', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1791
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('ابراهيم غاليه' , '', '', '', '0', '', '0', '2026-09-20 16:46:41', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=21
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('21', '0', '0', '', ''); -- id=21
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 ('21','0','0','0','إضافة عميل جديد','21', '0', '2026-09-20 16:46:41', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=120
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-20 16:46:42'); -- id=450
UPDATE client SET clientname = 'ابراهيم غاليه', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='450',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 = '21';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 13:17:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:47:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:47:59', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1792

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aaff1c30a7ef
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(21,@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-20 16:48:00', '06aaff1c30a7ef', '21', '0.00', '164.5', '0', '1', '164.50', '164.5', '0', '164.5', '1', '2026-09-20 16:48:00', '', '1', '0', 'ابراهيم غاليه', '1', '1', '3', '0', 'ابراهيم غاليه', '6' ,'0','','','','','-1','0','0','0','0','0','164','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=75
UPDATE client SET  clientdebt = '164.5', userid = '1' WHERE clientid = '21';
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 ('21','0.00','164.5','0','اضافة فاتورة مبيعات','75', '164.5', '2026-09-20 16:48:00', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '164.5', '0', null, '0', null, null,'', '0','1','1','164.5','1','2026-09-20 16:48:00','0','0','',''); -- id=121
UPDATE client SET  inUse = 0 where clientid = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('7.5','00296', '75', '6', '296', '1', '9', '9', '0', '', '1', '2026-09-20 16:48:01', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','9','9','0','','0','0.00','0','0','0','0'); -- id=494
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 = 494;
 INSERT INTO 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-20', 9, 7.5, 7.5
                    , 7.5, 7.5, 7.5, 7.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 7.5, 7.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+7.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 9, 7.5, 7.5
                    , 7.5, 7.5, 7.5, 7.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7.5, 7.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+7.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '1', storedetaildate = '2026-09-20 16:48:01' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '1', '1', '75', 'اضافة فاتورة مبيعات', 'sellbillController.php', '71', '70', '1', '2026-09-20 16:48:01','0','0'); -- id=1197
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00101', '75', '3', '101', '1', '17.75', '17.75', '0', '', '1', '2026-09-20 16:48:01', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','17.75','17.75','0','','0','0.00','0','0','0','0'); -- id=495
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 495;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-09-20', 17.75, 17.6, 17.6
                    , 17.6, 17.6, 17.6, 17.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 17.6, 17.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17.75, sellCostBuyPrice =sellCostBuyPrice+17.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 17.75, 17.6, 17.6
                    , 17.6, 17.6, 17.6, 17.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 17.6, 17.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17.75, sellCostBuyPrice =sellCostBuyPrice+17.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '389', userid = '1', storedetaildate = '2026-09-20 16:48:01' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '1', '1', '75', 'اضافة فاتورة مبيعات', 'sellbillController.php', '390', '389', '1', '2026-09-20 16:48:01','0','0'); -- id=1198
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('53.9','00119', '75', '3', '119', '2', '55', '110', '0', '', '1', '2026-09-20 16:48:01', '119', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','55','110','0','','0','0.00','0','0','0','0'); -- id=496
UPDATE sellbilldetail SET  lastbuyprice = 53.90 , meanbuyprice = 53.90, lastbuyprice_withDiscount = 53.90, meanbuyprice_withDiscount = 53.90
        , lastbuyprice_withTax = 53.9, meanbuyprice_withTax = 53.9, lastbuyprice_withDiscountAndTax = 53.9
                where sellbilldetailid = 496;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (119, '2026-09-20', 110, 107.8, 107.8
                    , 107.8, 107.8, 107.8, 107.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 107.8, 107.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+110, sellCostBuyPrice =sellCostBuyPrice+107.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+107.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+107.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+107.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+107.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+107.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+107.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+107.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-20', 110, 107.8, 107.8
                    , 107.8, 107.8, 107.8, 107.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 107.8, 107.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+110, sellCostBuyPrice =sellCostBuyPrice+107.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+107.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+107.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+107.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+107.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+107.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+107.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+107.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-20 16:48:02' WHERE storedetailid = '119';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('119', '1', '2', '1', '75', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '19', '1', '2026-09-20 16:48:02','0','0'); -- id=1199
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00120', '75', '3', '120', '1', '15.75', '15.75', '0', '', '1', '2026-09-20 16:48:02', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','10-1,','1','1','0','0','15.75','15.75','0','','0','0.00','0','0','0','0'); -- id=497
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 497;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (120, '2026-09-20', 15.75, 15, 15
                    , 15, 15, 15, 15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 15, 15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15.75, sellCostBuyPrice =sellCostBuyPrice+15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 15.75, 15, 15
                    , 15, 15, 15, 15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15.75, sellCostBuyPrice =sellCostBuyPrice+15
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '272', userid = '1', storedetaildate = '2026-09-20 16:48:02' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '1', '1', '75', 'اضافة فاتورة مبيعات', 'sellbillController.php', '273', '272', '1', '2026-09-20 16:48:02','0','0'); -- id=1200
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 11;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.75','00102', '75', '3', '102', '1', '12', '12', '0', '', '1', '2026-09-20 16:48:02', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-1,','1','1','0','0','12','12','0','','0','0.00','0','0','0','0'); -- id=498
UPDATE sellbilldetail SET  lastbuyprice = 11.75 , meanbuyprice = 11.75, lastbuyprice_withDiscount = 11.75, meanbuyprice_withDiscount = 11.75
        , lastbuyprice_withTax = 11.75, meanbuyprice_withTax = 11.75, lastbuyprice_withDiscountAndTax = 11.75
                where sellbilldetailid = 498;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-09-20', 12, 11.75, 11.75
                    , 11.75, 11.75, 11.75, 11.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 11.75, 11.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+11.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 12, 11.75, 11.75
                    , 11.75, 11.75, 11.75, 11.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11.75, 11.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12, sellCostBuyPrice =sellCostBuyPrice+11.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11.75
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1272', userid = '1', storedetaildate = '2026-09-20 16:48:02' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '1', '1', '75', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1273', '1272', '1', '2026-09-20 16:48:02','0','0'); -- id=1201
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '164.5', '164.5', '2026-09-20', '1', '0', '0', '2026-09-20 16:48:02','اضافة فاتورة مبيعات رقم 75','1','0',null,'0','75','sellbillController.php?do=showDetail&sellbillid=75'); -- id=685
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('685', '450', '164.5', '','0'); -- id=685
UPDATE accountstree SET name = 'ابراهيم غاليه', customName = 'ابراهيم غاليه', customNameEn = 'ابراهيم غاليه', nameEn = 'ابراهيم غاليه', parent = '58', accountNature = '0', theValue = '164.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 16:46:42' WHERE id = '450';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('685', '143', '164.5', '','0'); -- id=685
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '227064.34', 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 ( '159.65', '159.65', '2026-09-20', '1', '0', '0', '2026-09-20 16:48:02','اضافة فاتورة مبيعات رقم 75 - صرف البضاعة من المخزن','1','0',null,'0','75','sellbillController.php?do=showDetail&sellbillid=75'); -- id=686
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('686', '402', '159.65', '','0'); -- id=686
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '212479.7', 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 ('686', '382', '159.65', '','0'); -- id=686
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2151454.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='685,0,686' where sellbillid=75;
 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-20', 164.5, 159.65, 159.65
                    , 159.65, 159.65, 159.65, 159.65
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,159.65, 159.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+164.5, sellCostBuyPrice =sellCostBuyPrice+159.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (21, '2026-09-20', 164.5, 159.65, 159.65
                    , 159.65, 159.65, 159.65, 159.65
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,159.65, 159.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+164.5, sellCostBuyPrice =sellCostBuyPrice+159.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 164.5, 159.65, 159.65
                    , 159.65, 159.65, 159.65, 159.65, 159.65, 159.65)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+164.5, netSellCostBuyPrice = netSellCostBuyPrice+159.65
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+159.65
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+159.65
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+159.65
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+159.65
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+159.65
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+159.65
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+159.65;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aaff1c30a7ef and sellbillId = 75 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 13:18:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 16:48:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 16:48:04', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1793
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 14:19:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 17:49:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 17:49:44', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1794
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 14:26:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 17:56:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 17:56:19', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1795
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 14:27:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 17:57:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 17:57:39', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1796
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 ('متر سلك 1.5 الفؤاد ','','10','12','12','14','12','2026-09-20','0','1','0','','0','0','0','0','0','12','12','12','12','12','0','0','0','16.67','.','0','0','0','12','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','12','12','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','12','0','0','0','0','0','0','','','0','0','0','0'); -- id=430
UPDATE product SET productName = 'متر سلك 1.5 الفؤاد ', productDescription = '', productCatId = '10', productBuyPrice = '12', productSellAllPrice = '12', productSellUnitPrice = '14', productSellHalfPrice = '12', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00430',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '12',lastbuyprice_withDiscount = '12',meanbuyprice = '12',meanbuyprice_withDiscount = '12' , productbuypricereal = '12' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '16.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='12',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='12',meanbuyprice_withTax='12',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='12',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '430';
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', '430', '1.00', '2026-09-20', '1', '0','0043001','12','12','14','12','','0','0','0','0','0','0','0','0','0','0'); -- id=430
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('430', '1', '100', '1', '2026-09-20'); -- id=430
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('430', '1', '100', '0', '430', 'إضافة منتج', 'productController.php', '0', '100', '1', '2026-09-20','0','0'); -- id=1202
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (430, 1,'2026-09-20 17:57:40',1)
                ON DUPLICATE KEY UPDATE productid = 430, edited = 1, sysdate = '2026-09-20 17:57:40', userid = 1; -- id=535
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1200', '1200', '2026-09-20', '1', '0', '0', '2026-09-20 17:57:40','إضافة منتج متر سلك 1.5 الفؤاد  الكمية 100','1','0','0','0','430','productController.php?do=edit&id=430'); -- id=687
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('687', '382', '1200', '','0'); -- id=687
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2152654.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 ('687', '121', '1200', '','0'); -- id=687
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1177527.37', 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 = 'متر سلك 1.5 الفؤاد ', productDescription = '', productCatId = '10', productBuyPrice = '12.00', productSellAllPrice = '12.00', productSellUnitPrice = '14.00', productSellHalfPrice = '12.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00430',type ='0', expireDate = '0' , dailyentryId = '687',isService = '0',isOptic = '0',lastbuyprice = '12',lastbuyprice_withDiscount = '12',meanbuyprice = '12',meanbuyprice_withDiscount = '12' , productbuypricereal = '12' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '16.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='12',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='12',meanbuyprice_withTax='12',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='12',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '430';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 14:27:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 17:57:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 17:57:43', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1797
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 15:04:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 18:34:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 18:34:28', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1798

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab000994ab5c
-- ----------------------------------------------------------------------------------------------------

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-20 18:34:28', '06ab000994ab5c', '1', '0.00', '0', '0', '1', '1777.75', '1777.75', '1777.75', '0', '1', '2026-09-20 18:34:28', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '68' ,'0','','','','','-1','0','0','0','0','0','1777','0','','0','0','1777.75','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=76
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','اضافة فاتورة مبيعات','76', '0', '2026-09-20 18:34:29', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '1777.75', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 18:34:28','0','0','',''); -- id=122
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00043', '76', '1', '43', '11', '30.75', '338.25', '0', '', '1', '2026-09-20 18:34:29', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30.75','338.25','0','','0','0.00','0','0','0','0'); -- id=499
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 499;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-09-20', 338.25, 324.5, 324.5
                    , 324.5, 324.5, 324.5, 324.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11, 0, 324.5, 324.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+338.25, sellCostBuyPrice =sellCostBuyPrice+324.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+324.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+324.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+324.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+324.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+324.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+324.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+324.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+11
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 338.25, 324.5, 324.5
                    , 324.5, 324.5, 324.5, 324.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 324.5, 324.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+338.25, sellCostBuyPrice =sellCostBuyPrice+324.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+324.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+324.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+324.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+324.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+324.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+324.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+324.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 = '756', userid = '1', storedetaildate = '2026-09-20 18:34:29' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '11', '1', '76', 'اضافة فاتورة مبيعات', 'sellbillController.php', '767', '756', '1', '2026-09-20 18:34:29','0','0'); -- id=1203
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('232','00113', '76', '3', '113', '1', '240', '240', '0', '', '1', '2026-09-20 18:34:29', '113', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','240','240','0','','0','0.00','0','0','0','0'); -- id=500
UPDATE sellbilldetail SET  lastbuyprice = 232.00 , meanbuyprice = 232.00, lastbuyprice_withDiscount = 232.00, meanbuyprice_withDiscount = 232.00
        , lastbuyprice_withTax = 232, meanbuyprice_withTax = 232, lastbuyprice_withDiscountAndTax = 232
                where sellbilldetailid = 500;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (113, '2026-09-20', 240, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, sellCostBuyPrice =sellCostBuyPrice+232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+232, sellCostMeanBuyPrice = sellCostMeanBuyPrice+232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+232
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 240, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, sellCostBuyPrice =sellCostBuyPrice+232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+232, sellCostMeanBuyPrice = sellCostMeanBuyPrice+232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+232
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 18:34:30' WHERE storedetailid = '113';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('113', '1', '1', '1', '76', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7', '6', '1', '2026-09-20 18:34:30','0','0'); -- id=1204
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('45','00377', '76', '6', '377', '1', '50', '50', '0', '', '1', '2026-09-20 18:34:30', '377', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','50','50','0','','0','0.00','0','0','0','0'); -- id=501
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 501;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (377, '2026-09-20', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-09-20 18:34:30' WHERE storedetailid = '377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('377', '1', '1', '1', '76', 'اضافة فاتورة مبيعات', 'sellbillController.php', '37', '36', '1', '2026-09-20 18:34:30','0','0'); -- id=1205
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '76', '6', '207', '3', '15', '45', '0', '', '1', '2026-09-20 18:34:30', '207', '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=502
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 = 502;
 INSERT INTO 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-20', 45, 33, 33
                    , 33, 33, 33, 33
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 33, 33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+33
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+33, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+33
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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+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-20', 45, 33, 33
                    , 33, 33, 33, 33
                    , 0, 0, 0, 0
                    , 0, 0, 0, 33, 33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+33
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+33, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+33
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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 = '145', userid = '1', storedetaildate = '2026-09-20 18:34:30' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '3', '1', '76', 'اضافة فاتورة مبيعات', 'sellbillController.php', '148', '145', '1', '2026-09-20 18:34:30','0','0'); -- id=1206
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('21','00417', '76', '10', '417', '35', '23.5', '822.5', '0', '', '1', '2026-09-20 18:34:31', '417', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23.5','822.5','0','','0','0.00','0','0','0','0'); -- id=503
UPDATE sellbilldetail SET  lastbuyprice = 21.00 , meanbuyprice = 21.00, lastbuyprice_withDiscount = 21.00, meanbuyprice_withDiscount = 21.00
        , lastbuyprice_withTax = 21, meanbuyprice_withTax = 21, lastbuyprice_withDiscountAndTax = 21
                where sellbilldetailid = 503;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (417, '2026-09-20', 822.5, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+822.5, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+35
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 822.5, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+822.5, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-09-20 18:34:31' WHERE storedetailid = '417';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('417', '1', '35', '1', '76', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '25', '1', '2026-09-20 18:34:31','0','0'); -- id=1207
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '76', '1', '4', '2', '36', '72', '0', '', '1', '2026-09-20 18:34:31', '4', '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=504
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 = 504;
 INSERT INTO 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-20', 72, 69.6, 69.6
                    , 69.6, 69.6, 69.6, 69.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 69.6, 69.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+69.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 72, 69.6, 69.6
                    , 69.6, 69.6, 69.6, 69.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 69.6, 69.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+69.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+69.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+69.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+69.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+69.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+69.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+69.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+69.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 = '1891', userid = '1', storedetaildate = '2026-09-20 18:34:31' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '2', '1', '76', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1893', '1891', '1', '2026-09-20 18:34:31','0','0'); -- id=1208
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00430', '76', '10', '430', '15', '14', '210', '0', '', '1', '2026-09-20 18:34:31', '430', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','14','210','0','','0','0.00','0','0','0','0'); -- id=505
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 = 505;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (430, '2026-09-20', 210, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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+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-20', 210, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, 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 = '85', userid = '1', storedetaildate = '2026-09-20 18:34:31' WHERE storedetailid = '430';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('430', '1', '15', '1', '76', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '85', '1', '2026-09-20 18:34:32','0','0'); -- id=1209
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-203785.234375',  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 ('-205562.984375','1777.75', '0', '1', 'اضافة فاتورة مبيعات', '76', '-203785.234375', '2026-09-20 18:34:32', '1',  'sellbillController.php','1','','0'); -- id=72
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1777.75', '1777.75', '2026-09-20', '1', '0', '0', '2026-09-20 18:34:32','اضافة فاتورة مبيعات رقم 76','1','0',null,'0','76','sellbillController.php?do=showDetail&sellbillid=76'); -- id=688
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('688', '383', '1777.75', '','0'); -- id=688
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-157093.23', 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 ('688', '143', '1777.75', '','0'); -- id=688
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '228842.09', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1619.1', '1619.1', '2026-09-20', '1', '0', '0', '2026-09-20 18:34:32','اضافة فاتورة مبيعات رقم 76 - صرف البضاعة من المخزن','1','0',null,'0','76','sellbillController.php?do=showDetail&sellbillid=76'); -- id=689
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('689', '402', '1619.1', '','0'); -- id=689
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '214098.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 ('689', '382', '1619.1', '','0'); -- id=689
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2151035.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='688,0,689' where sellbillid=76;
 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-20', 1777.75, 1619.1, 1619.1
                    , 1619.1, 1619.1, 1619.1, 1619.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1619.1, 1619.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1777.75, sellCostBuyPrice =sellCostBuyPrice+1619.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1619.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1619.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1619.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1619.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1619.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1619.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1619.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 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-20', 1777.75, 1619.1, 1619.1
                    , 1619.1, 1619.1, 1619.1, 1619.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1619.1, 1619.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1777.75, sellCostBuyPrice =sellCostBuyPrice+1619.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1619.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1619.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1619.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1619.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1619.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1619.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1619.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1777.75, 1619.1, 1619.1
                    , 1619.1, 1619.1, 1619.1, 1619.1, 1619.1, 1619.1)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1777.75, netSellCostBuyPrice = netSellCostBuyPrice+1619.1
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1619.1
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1619.1
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1619.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1619.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1619.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1619.1
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1619.1;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab000994ab5c and sellbillId = 76 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 15:04:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 18:34:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 18:34:33', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1799
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:09:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:40:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 21:40:00', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=1800
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:10:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:40:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 21:40:05', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1801
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:10:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:40:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 21:40:10', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=1802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:10:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:40:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 21:40:11', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=1803
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:10:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:40:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 21:40:37', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1804
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:10:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:40:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 21:40:50', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1805
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:10:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:40:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 21:40:56', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=22'); -- id=1806
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:11:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:41:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 21:41:37', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1807
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 22;
UPDATE sellbill SET  sellbillsysdate = '2026-09-20 21:41:38', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '22';
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 = 133;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-09-20', 93.75, 88.5, 88.5
                    , 88.5, 88.5, 88.5, 88.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 88.5, 88.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93.75, sellCostBuyPrice =sellCostBuyPrice-88.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 93.75, 88.5, 88.5
                    , 88.5, 88.5, 88.5, 88.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88.5, 88.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-93.75, sellCostBuyPrice =sellCostBuyPrice-88.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '460', userid = '1', storedetaildate = '2026-09-20 21:41:38' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '15', '0', '22', 'تعديل فاتورة مبيعات', 'sellbillController.php', '445', '460', '1', '2026-09-16 13:31:12','0','0'); -- id=1210
UPDATE sellbilldetail SET  lastbuyprice = 312.00 , meanbuyprice = 312.00, lastbuyprice_withDiscount = 312.00, meanbuyprice_withDiscount = 312.00
        , lastbuyprice_withTax = 312, meanbuyprice_withTax = 312, lastbuyprice_withDiscountAndTax = 312
                where sellbilldetailid = 134;
 INSERT INTO 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-20', 1140, 936, 936
                    , 936, 936, 936, 936
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 936, 936, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1140, sellCostBuyPrice =sellCostBuyPrice-936
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-936, sellCostMeanBuyPrice = sellCostMeanBuyPrice-936
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-936, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-936
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-936
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-936
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-936
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 1140, 936, 936
                    , 936, 936, 936, 936
                    , 0, 0, 0, 0
                    , 0, 0, 0, 936, 936, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1140, sellCostBuyPrice =sellCostBuyPrice-936
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-936, sellCostMeanBuyPrice = sellCostMeanBuyPrice-936
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-936, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-936
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-936
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-936
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-936
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 21:41:38' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '3', '0', '22', 'تعديل فاتورة مبيعات', 'sellbillController.php', '53', '56', '1', '2026-09-16 13:31:12','0','0'); -- id=1211
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 135;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (229, '2026-09-20', 1120, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1120, sellCostBuyPrice =sellCostBuyPrice-1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 1120, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1120, sellCostBuyPrice =sellCostBuyPrice-1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1000
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 21:41:38' WHERE storedetailid = '229';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '1', '1', '0', '22', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '20', '1', '2026-09-16 13:31:12','0','0'); -- id=1212
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 = 136;
 INSERT INTO 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-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19, sellCostBuyPrice =sellCostBuyPrice-18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '622', userid = '1', storedetaildate = '2026-09-20 21:41:38' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '0', '22', 'تعديل فاتورة مبيعات', 'sellbillController.php', '621', '622', '1', '2026-09-16 13:31:12','0','0'); -- id=1213
CALL clientInUse(9,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '2195', userid = '1' WHERE clientid = '9';
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 ('9','4567.75','2372.75','1','تعديل فاتورة مبيعات','22', '2195', '2026-09-16 13:31:12', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '2372.75', '0', null, '0', null, null,'', '0','1','1','2372.75','1','2026-09-16 13:31:12','0','0','',''); -- id=123
UPDATE client SET  inUse = 0 where clientid = 9;
 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-20', 2372.75, 2042.5, 2042.5
                    , 2042.5, 2042.5, 2042.5, 2042.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2042.5, 2042.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2372.75, sellCostBuyPrice =sellCostBuyPrice-2042.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2042.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2042.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2042.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2042.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2042.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2042.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2042.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-09-20', 2372.75, 2042.5, 2042.5
                    , 2042.5, 2042.5, 2042.5, 2042.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2042.5, 2042.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2372.75, sellCostBuyPrice =sellCostBuyPrice-2042.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2042.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2042.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2042.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2042.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2042.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2042.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2042.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2372.75, 2042.5, 2042.5
                    , 2042.5, 2042.5, 2042.5, 2042.5, 2042.5, 2042.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-2372.75, netSellCostBuyPrice = netSellCostBuyPrice-2042.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-2042.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-2042.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-2042.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-2042.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-2042.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-2042.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-2042.5;

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


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

COMMIT;
BEGIN;
CALL clientInUse(9,@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-16 13:31:12', '06aaa7d9d9ec11', '9', '2195.00', '4798.75', '0', '1', '2603.75', '2603.75', '0', '2603.75', '1', '2026-09-16 13:31:12', '', '1', '0', 'طارق عز', '1', '1', '3', '0', '9 - طارق عز', '34', '22', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-16','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=77
UPDATE client SET  clientdebt = '4798.75', userid = '1' WHERE clientid = '9';
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 ('9','2195.00','2603.75','0','اضافة فاتورة مبيعات (معدله)','77', '4798.75', '2026-09-20 21:41:39', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2603.75', '0', null, '0', null, null,'', '0','1','1','2372.75','1','2026-09-16 13:31:12','0','0','',''); -- id=124
UPDATE client SET  inUse = 0 where clientid = 9;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '77', '12', '86', '15.00', '6.25', '93.75', '0', '', '1', '2026-09-20 21:41:39', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.25','93.75','0','','0','0.00','0','0','0','0'); -- id=506
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 = 506;
 INSERT INTO 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-20', 93.75, 88.5, 88.5
                    , 88.5, 88.5, 88.5, 88.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 88.5, 88.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93.75, sellCostBuyPrice =sellCostBuyPrice+88.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 93.75, 88.5, 88.5
                    , 88.5, 88.5, 88.5, 88.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88.5, 88.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+93.75, sellCostBuyPrice =sellCostBuyPrice+88.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '445', userid = '1', storedetaildate = '2026-09-20 21:41:39' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '15', '1', '77', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '460', '445', '1', '2026-09-20 21:41:39','0','0'); -- id=1214
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('312','00070', '77', '12', '70', '3.00', '380', '1140', '0', '', '1', '2026-09-20 21:41:39', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','380','1140','0','','0','0.00','0','0','0','0'); -- id=507
UPDATE sellbilldetail SET  lastbuyprice = 312.00 , meanbuyprice = 312.00, lastbuyprice_withDiscount = 312.00, meanbuyprice_withDiscount = 312.00
        , lastbuyprice_withTax = 312, meanbuyprice_withTax = 312, lastbuyprice_withDiscountAndTax = 312
                where sellbilldetailid = 507;
 INSERT INTO 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-20', 1140, 936, 936
                    , 936, 936, 936, 936
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 936, 936, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1140, sellCostBuyPrice =sellCostBuyPrice+936
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+936, sellCostMeanBuyPrice = sellCostMeanBuyPrice+936
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+936, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+936
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+936
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+936
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+936
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1140, 936, 936
                    , 936, 936, 936, 936
                    , 0, 0, 0, 0
                    , 0, 0, 0, 936, 936, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1140, sellCostBuyPrice =sellCostBuyPrice+936
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+936, sellCostMeanBuyPrice = sellCostMeanBuyPrice+936
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+936, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+936
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+936
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+936
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+936
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-09-20 21:41:40' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '3', '1', '77', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '56', '53', '1', '2026-09-20 21:41:40','0','0'); -- id=1215
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1000','00229', '77', '10', '229', '1.00', '1120', '1120', '0', '', '1', '2026-09-20 21:41:40', '229', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1120','1120','0','','0','0.00','0','0','0','0'); -- id=508
UPDATE sellbilldetail SET  lastbuyprice = 1000.00 , meanbuyprice = 1000.00, lastbuyprice_withDiscount = 1000.00, meanbuyprice_withDiscount = 1000.00
        , lastbuyprice_withTax = 1000, meanbuyprice_withTax = 1000, lastbuyprice_withDiscountAndTax = 1000
                where sellbilldetailid = 508;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (229, '2026-09-20', 1120, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1120, sellCostBuyPrice =sellCostBuyPrice+1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1120, 1000, 1000
                    , 1000, 1000, 1000, 1000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1120, sellCostBuyPrice =sellCostBuyPrice+1000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 21:41:40' WHERE storedetailid = '229';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('229', '1', '1', '1', '77', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '19', '1', '2026-09-20 21:41:40','0','0'); -- id=1216
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '77', '14', '81', '1.00', '19', '19', '0', '', '1', '2026-09-20 21:41:40', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','19','0','','0','0.00','0','0','0','0'); -- id=509
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 = 509;
 INSERT INTO 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-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 19, 18, 18
                    , 18, 18, 18, 18
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 18, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19, sellCostBuyPrice =sellCostBuyPrice+18
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '621', userid = '1', storedetaildate = '2026-09-20 21:41:40' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '1', '1', '77', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '622', '621', '1', '2026-09-20 21:41:40','0','0'); -- id=1217
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '77', '6', '315', '7', '8', '56', '0', '', '1', '2026-09-20 21:41:41', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','56','0','','0','0.00','0','0','0','0'); -- id=510
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 = 510;
 INSERT INTO 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-20', 56, 45.5, 45.5
                    , 45.5, 45.5, 45.5, 45.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 45.5, 45.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+45.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45.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-20', 56, 45.5, 45.5
                    , 45.5, 45.5, 45.5, 45.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45.5, 45.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56, sellCostBuyPrice =sellCostBuyPrice+45.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45.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 = '785', userid = '1', storedetaildate = '2026-09-20 21:41:41' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '7', '1', '77', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '792', '785', '1', '2026-09-20 21:41:41','0','0'); -- id=1218
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00166', '77', '2', '166', '7', '25', '175', '0', '', '1', '2026-09-20 21:41:41', '166', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','25','175','0','','0','0.00','0','0','0','0'); -- id=511
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 = 511;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (166, '2026-09-20', 175, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+175, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 175, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+175, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '178', userid = '1', storedetaildate = '2026-09-20 21:41:41' WHERE storedetailid = '166';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('166', '1', '7', '1', '77', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '185', '178', '1', '2026-09-20 21:41:41','0','0'); -- id=1219
UPDATE dailyentry SET totalcreditor = '2372.75', totaldebtor = '2372.75', thedate = '2026-09-16', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-16 13:31:14', entryComment = 'اضافة فاتورة مبيعات رقم 22', fromFlag = '1',related='0',isopeningentry='0',operationId='22',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=22' WHERE id = '390';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2372.75', '2372.75', '2026-09-20', '1', '0', '390', '2026-09-20 21:41:41','تم عكس القيد رقم 390 ','1','0','0','0','0',''); -- id=690
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('690', '436', '2372.75', '','0'); -- id=690
UPDATE accountstree SET name = 'طارق عز', customName = 'طارق عز', customNameEn = 'طارق عز', nameEn = 'طارق عز', parent = '58', accountNature = '0', theValue = '2195', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 13:28:38' WHERE id = '436';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('690', '143', '2372.75', '','0'); -- id=690
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '226469.34', 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 = '2042.50', totaldebtor = '2042.50', thedate = '2026-09-16', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-16 13:31:14', entryComment = 'اضافة فاتورة مبيعات رقم 22 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='22',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=22' WHERE id = '391';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2042.50', '2042.50', '2026-09-20', '1', '0', '391', '2026-09-20 21:41:42','تم عكس القيد رقم 391 ','1','0','0','0','0',''); -- id=691
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('691', '402', '2042.50', '','0'); -- id=691
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '212056.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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('691', '382', '2042.50', '','0'); -- id=691
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2153077.77', 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 ( '2603.75', '2603.75', '2026-09-20', '1', '0', '0', '2026-09-20 21:41:42','اضافة فاتورة مبيعات رقم 77','1','0',null,'0','77','sellbillController.php?do=showDetail&sellbillid=77'); -- id=692
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('692', '436', '2603.75', '','0'); -- id=692
UPDATE accountstree SET name = 'طارق عز', customName = 'طارق عز', customNameEn = 'طارق عز', nameEn = 'طارق عز', parent = '58', accountNature = '0', theValue = '4798.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 13:28:38' WHERE id = '436';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('692', '143', '2603.75', '','0'); -- id=692
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '229073.09', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2214', '2214', '2026-09-20', '1', '0', '0', '2026-09-20 21:41:42','اضافة فاتورة مبيعات رقم 77 - صرف البضاعة من المخزن','1','0',null,'0','77','sellbillController.php?do=showDetail&sellbillid=77'); -- id=693
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('693', '402', '2214', '','0'); -- id=693
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '214270.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 ('693', '382', '2214', '','0'); -- id=693
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2150863.77', 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='692,0,693' where sellbillid=77;
 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-20', 2603.75, 2214, 2214
                    , 2214, 2214, 2214, 2214
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2214, 2214, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2603.75, sellCostBuyPrice =sellCostBuyPrice+2214
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2214, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2214
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2214, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2214
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2214
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2214
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2214
                        , returnSellVal = returnSellVal+0, 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 (9, '2026-09-20', 2603.75, 2214, 2214
                    , 2214, 2214, 2214, 2214
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2214, 2214, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2603.75, sellCostBuyPrice =sellCostBuyPrice+2214
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2214, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2214
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2214, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2214
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2214
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2214
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2214
                        , returnSellVal = returnSellVal+0, 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, 2603.75, 2214, 2214
                    , 2214, 2214, 2214, 2214, 2214, 2214)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2603.75, netSellCostBuyPrice = netSellCostBuyPrice+2214
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2214
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2214
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2214
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2214
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2214
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2214
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2214;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 22 and newid=77 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:11:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:41:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 21:41:44', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=77'); -- id=1808
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:11:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:41:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 21:41:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=1809
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:11:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:41:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-20 21:41:54', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=1810
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:11:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:41:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 21:41:54', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=1811
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:12:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 21:42:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 21:42:02', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1812
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:37:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:07:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:07:19', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1813

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06aafa27e66c97
-- ----------------------------------------------------------------------------------------------------

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-20 22:07:20', '06aafa27e66c97', '1', '0.00', '0', '0', '1', '21305.86', '21305.86', '21305.86', '0', '1', '2026-09-20 22:07:20', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '370.5' ,'0','','','','','-1','0','0','0','0','0','21305','0','','0','0','21305.86','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=78
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','اضافة فاتورة مبيعات','78', '0', '2026-09-20 22:07:20', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '21305.86', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-20 22:07:20','0','0','',''); -- id=125
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.79','00355', '78', '1', '355', '12', '54.78', '657.36', '0', '', '1', '2026-09-20 22:07:20', '355', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54.78','657.36','0','','0','0.00','0','0','0','0'); -- id=512
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 512;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (355, '2026-09-20', 657.36, 633.48, 633.48
                    , 633.48, 633.48, 633.48, 633.48
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 633.48, 633.48, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+657.36, sellCostBuyPrice =sellCostBuyPrice+633.48
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633.48, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633.48
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633.48, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633.48
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633.48
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633.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
                        , 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-20', 657.36, 633.48, 633.48
                    , 633.48, 633.48, 633.48, 633.48
                    , 0, 0, 0, 0
                    , 0, 0, 0, 633.48, 633.48, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+657.36, sellCostBuyPrice =sellCostBuyPrice+633.48
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633.48, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633.48
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633.48, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633.48
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633.48
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633.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;
UPDATE storedetail SET  productquantity = '182', userid = '1', storedetaildate = '2026-09-20 22:07:21' WHERE storedetailid = '355';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('355', '1', '12', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '194', '182', '1', '2026-09-20 22:07:21','0','0'); -- id=1220
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00357', '78', '1', '357', '8', '36', '288', '0', '', '1', '2026-09-20 22:07:21', '357', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','288','0','','0','0.00','0','0','0','0'); -- id=513
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 = 513;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (357, '2026-09-20', 288, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+288, 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+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-20', 288, 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+288, 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 = '251', userid = '1', storedetaildate = '2026-09-20 22:07:21' WHERE storedetailid = '357';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('357', '1', '8', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '259', '251', '1', '2026-09-20 22:07:21','0','0'); -- id=1221
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00366', '78', '1', '366', '1', '246.5', '246.5', '0', '', '1', '2026-09-20 22:07:21', '366', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','246.5','246.5','0','','0','0.00','0','0','0','0'); -- id=514
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 = 514;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (366, '2026-09-20', 246.5, 237, 237
                    , 237, 237, 237, 237
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 237, 237, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+246.5, sellCostBuyPrice =sellCostBuyPrice+237
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+237, sellCostMeanBuyPrice = sellCostMeanBuyPrice+237
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+237, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+237
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+237
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+237
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+237
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 246.5, 237, 237
                    , 237, 237, 237, 237
                    , 0, 0, 0, 0
                    , 0, 0, 0, 237, 237, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+246.5, sellCostBuyPrice =sellCostBuyPrice+237
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+237, sellCostMeanBuyPrice = sellCostMeanBuyPrice+237
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+237, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+237
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+237
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+237
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+237
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 22:07:21' WHERE storedetailid = '366';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('366', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '4', '1', '2026-09-20 22:07:21','0','0'); -- id=1222
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00356', '78', '1', '356', '10', '36', '360', '0', '', '1', '2026-09-20 22:07:21', '356', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','360','0','','0','0.00','0','0','0','0'); -- id=515
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 = 515;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (356, '2026-09-20', 360, 348, 348
                    , 348, 348, 348, 348
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 348, 348, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+348
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+348
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+348
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+348
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 360, 348, 348
                    , 348, 348, 348, 348
                    , 0, 0, 0, 0
                    , 0, 0, 0, 348, 348, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+360, sellCostBuyPrice =sellCostBuyPrice+348
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+348, sellCostMeanBuyPrice = sellCostMeanBuyPrice+348
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+348, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+348
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+348
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+348
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+348
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '244', userid = '1', storedetaildate = '2026-09-20 22:07:22' WHERE storedetailid = '356';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('356', '1', '10', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '254', '244', '1', '2026-09-20 22:07:22','0','0'); -- id=1223
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00359', '78', '1', '359', '1', '106', '106', '0', '', '1', '2026-09-20 22:07:22', '359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','106','106','0','','0','0.00','0','0','0','0'); -- id=516
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 = 516;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (359, '2026-09-20', 106, 105, 105
                    , 105, 105, 105, 105
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 105, 105, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+106, sellCostBuyPrice =sellCostBuyPrice+105
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 106, 105, 105
                    , 105, 105, 105, 105
                    , 0, 0, 0, 0
                    , 0, 0, 0, 105, 105, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+106, sellCostBuyPrice =sellCostBuyPrice+105
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 22:07:22' WHERE storedetailid = '359';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('359', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '26', '25', '1', '2026-09-20 22:07:22','0','0'); -- id=1224
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('47','00364', '78', '1', '364', '1', '49.9', '49.9', '0', '', '1', '2026-09-20 22:07:22', '364', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','49.9','49.9','0','','0','0.00','0','0','0','0'); -- id=517
UPDATE sellbilldetail SET  lastbuyprice = 47.00 , meanbuyprice = 47.00, lastbuyprice_withDiscount = 47.00, meanbuyprice_withDiscount = 47.00
        , lastbuyprice_withTax = 47, meanbuyprice_withTax = 47, lastbuyprice_withDiscountAndTax = 47
                where sellbilldetailid = 517;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (364, '2026-09-20', 49.9, 47, 47
                    , 47, 47, 47, 47
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 47, 47, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49.9, sellCostBuyPrice =sellCostBuyPrice+47
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+47, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+47
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+47
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+47
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 49.9, 47, 47
                    , 47, 47, 47, 47
                    , 0, 0, 0, 0
                    , 0, 0, 0, 47, 47, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49.9, sellCostBuyPrice =sellCostBuyPrice+47
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+47, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+47
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+47
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+47
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-09-20 22:07:22' WHERE storedetailid = '364';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('364', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '32', '1', '2026-09-20 22:07:22','0','0'); -- id=1225
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.46','00365', '78', '1', '365', '1', '87', '87', '0', '', '1', '2026-09-20 22:07:22', '365', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','87','87','0','','0','0.00','0','0','0','0'); -- id=518
UPDATE sellbilldetail SET  lastbuyprice = 84.46 , meanbuyprice = 84.46, lastbuyprice_withDiscount = 84.46, meanbuyprice_withDiscount = 84.46
        , lastbuyprice_withTax = 84.46, meanbuyprice_withTax = 84.46, lastbuyprice_withDiscountAndTax = 84.46
                where sellbilldetailid = 518;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (365, '2026-09-20', 87, 84.46, 84.46
                    , 84.46, 84.46, 84.46, 84.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 84.46, 84.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+87, sellCostBuyPrice =sellCostBuyPrice+84.46
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.46, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.46, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.46
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.46
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 87, 84.46, 84.46
                    , 84.46, 84.46, 84.46, 84.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 84.46, 84.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+87, sellCostBuyPrice =sellCostBuyPrice+84.46
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.46, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.46, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.46
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.46
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '38', userid = '1', storedetaildate = '2026-09-20 22:07:23' WHERE storedetailid = '365';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('365', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '38', '1', '2026-09-20 22:07:23','0','0'); -- id=1226
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00360', '78', '1', '360', '20', '10.95', '219', '0', '', '1', '2026-09-20 22:07:23', '360', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','219','0','','0','0.00','0','0','0','0'); -- id=519
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 = 519;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (360, '2026-09-20', 219, 211, 211
                    , 211, 211, 211, 211
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 211, 211, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+219, sellCostBuyPrice =sellCostBuyPrice+211
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+211, sellCostMeanBuyPrice = sellCostMeanBuyPrice+211
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+211, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+211
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+211
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+211
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+211
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 219, 211, 211
                    , 211, 211, 211, 211
                    , 0, 0, 0, 0
                    , 0, 0, 0, 211, 211, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+219, sellCostBuyPrice =sellCostBuyPrice+211
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+211, sellCostMeanBuyPrice = sellCostMeanBuyPrice+211
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+211, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+211
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+211
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+211
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+211
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '289', userid = '1', storedetaildate = '2026-09-20 22:07:23' WHERE storedetailid = '360';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('360', '1', '20', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '309', '289', '1', '2026-09-20 22:07:23','0','0'); -- id=1227
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('44.33','00041', '78', '1', '41', '70', '46', '3220', '0', '', '1', '2026-09-20 22:07:23', '41', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','46','3220','0','','0','0.00','0','0','0','0'); -- id=520
UPDATE sellbilldetail SET  lastbuyprice = 44.33 , meanbuyprice = 44.33, lastbuyprice_withDiscount = 44.33, meanbuyprice_withDiscount = 44.33
        , lastbuyprice_withTax = 44.33, meanbuyprice_withTax = 44.33, lastbuyprice_withDiscountAndTax = 44.33
                where sellbilldetailid = 520;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (41, '2026-09-20', 3220, 3103.1, 3103.1
                    , 3103.1, 3103.1, 3103.1, 3103.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70, 0, 3103.1, 3103.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3220, sellCostBuyPrice =sellCostBuyPrice+3103.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3103.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3103.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3103.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3103.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3103.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3103.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3103.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+70
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 3220, 3103.1, 3103.1
                    , 3103.1, 3103.1, 3103.1, 3103.1
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3103.1, 3103.1, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3220, sellCostBuyPrice =sellCostBuyPrice+3103.1
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3103.1, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3103.1
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3103.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3103.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3103.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3103.1
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3103.1
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '475', userid = '1', storedetaildate = '2026-09-20 22:07:23' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '70', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '545', '475', '1', '2026-09-20 22:07:23','0','0'); -- id=1228
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237.5','00045', '78', '1', '45', '6', '246.5', '1479', '0', '', '1', '2026-09-20 22:07:23', '45', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','246.5','1479','0','','0','0.00','0','0','0','0'); -- id=521
UPDATE sellbilldetail SET  lastbuyprice = 237.50 , meanbuyprice = 237.50, lastbuyprice_withDiscount = 237.50, meanbuyprice_withDiscount = 237.50
        , lastbuyprice_withTax = 237.5, meanbuyprice_withTax = 237.5, lastbuyprice_withDiscountAndTax = 237.5
                where sellbilldetailid = 521;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (45, '2026-09-20', 1479, 1425, 1425
                    , 1425, 1425, 1425, 1425
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1479, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1425, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1425
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1425
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1479, 1425, 1425
                    , 1425, 1425, 1425, 1425
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1479, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1425, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1425
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1425
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '68', userid = '1', storedetaildate = '2026-09-20 22:07:24' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '6', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '74', '68', '1', '2026-09-20 22:07:24','0','0'); -- id=1229
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('36.95','00051', '78', '1', '51', '3', '38.7', '116.10000000000001', '0', '', '1', '2026-09-20 22:07:24', '51', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','38.7','116.1','0','','0','0.00','0','0','0','0'); -- id=522
UPDATE sellbilldetail SET  lastbuyprice = 36.95 , meanbuyprice = 36.95, lastbuyprice_withDiscount = 36.95, meanbuyprice_withDiscount = 36.95
        , lastbuyprice_withTax = 36.95, meanbuyprice_withTax = 36.95, lastbuyprice_withDiscountAndTax = 36.95
                where sellbilldetailid = 522;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (51, '2026-09-20', 116.1, 110.85, 110.85
                    , 110.85, 110.85, 110.85, 110.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 110.85, 110.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+116.1, sellCostBuyPrice =sellCostBuyPrice+110.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110.85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 116.1, 110.85, 110.85
                    , 110.85, 110.85, 110.85, 110.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 110.85, 110.85, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+116.1, sellCostBuyPrice =sellCostBuyPrice+110.85
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110.85, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110.85
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110.85, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110.85
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110.85
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110.85
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '86', userid = '1', storedetaildate = '2026-09-20 22:07:24' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '3', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '89', '86', '1', '2026-09-20 22:07:24','0','0'); -- id=1230
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('68.63','00052', '78', '1', '52', '3', '72', '216', '0', '', '1', '2026-09-20 22:07:24', '52', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','72','216','0','','0','0.00','0','0','0','0'); -- id=523
UPDATE sellbilldetail SET  lastbuyprice = 68.63 , meanbuyprice = 68.63, lastbuyprice_withDiscount = 68.63, meanbuyprice_withDiscount = 68.63
        , lastbuyprice_withTax = 68.63, meanbuyprice_withTax = 68.63, lastbuyprice_withDiscountAndTax = 68.63
                where sellbilldetailid = 523;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (52, '2026-09-20', 216, 205.89, 205.89
                    , 205.89, 205.89, 205.89, 205.89
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 205.89, 205.89, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+216, sellCostBuyPrice =sellCostBuyPrice+205.89
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+205.89, sellCostMeanBuyPrice = sellCostMeanBuyPrice+205.89
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+205.89, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+205.89
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+205.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+205.89
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+205.89
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 216, 205.89, 205.89
                    , 205.89, 205.89, 205.89, 205.89
                    , 0, 0, 0, 0
                    , 0, 0, 0, 205.89, 205.89, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+216, sellCostBuyPrice =sellCostBuyPrice+205.89
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+205.89, sellCostMeanBuyPrice = sellCostMeanBuyPrice+205.89
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+205.89, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+205.89
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+205.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+205.89
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+205.89
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '130', userid = '1', storedetaildate = '2026-09-20 22:07:24' WHERE storedetailid = '52';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('52', '1', '3', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '133', '130', '1', '2026-09-20 22:07:24','0','0'); -- id=1231
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00042', '78', '1', '42', '50', '30.75', '1537.5', '0', '', '1', '2026-09-20 22:07:24', '42', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30.75','1537.5','0','','0','0.00','0','0','0','0'); -- id=524
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 524;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (42, '2026-09-20', 1537.5, 1475, 1475
                    , 1475, 1475, 1475, 1475
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 1475, 1475, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1537.5, sellCostBuyPrice =sellCostBuyPrice+1475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1475, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1475, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1475
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1475
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1475
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1537.5, 1475, 1475
                    , 1475, 1475, 1475, 1475
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1475, 1475, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1537.5, sellCostBuyPrice =sellCostBuyPrice+1475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1475, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1475, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1475
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1475
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1475
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '794', userid = '1', storedetaildate = '2026-09-20 22:07:25' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '50', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '844', '794', '1', '2026-09-20 22:07:25','0','0'); -- id=1232
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.5','00043', '78', '1', '43', '60', '30.75', '1845', '0', '', '1', '2026-09-20 22:07:25', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30.75','1845','0','','0','0.00','0','0','0','0'); -- id=525
UPDATE sellbilldetail SET  lastbuyprice = 29.50 , meanbuyprice = 29.50, lastbuyprice_withDiscount = 29.50, meanbuyprice_withDiscount = 29.50
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where sellbilldetailid = 525;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (43, '2026-09-20', 1845, 1770, 1770
                    , 1770, 1770, 1770, 1770
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1845, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1770
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1770
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+60
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1845, 1770, 1770
                    , 1770, 1770, 1770, 1770
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1770, 1770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1845, sellCostBuyPrice =sellCostBuyPrice+1770
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1770, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1770
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1770, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1770
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1770
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1770
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '696', userid = '1', storedetaildate = '2026-09-20 22:07:25' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '60', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '756', '696', '1', '2026-09-20 22:07:25','0','0'); -- id=1233
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '78', '1', '9', '6', '319', '1914', '0', '', '1', '2026-09-20 22:07:25', '9', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','319','1914','0','','0','0.00','0','0','0','0'); -- id=526
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 = 526;
 INSERT INTO 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-20', 1914, 1836, 1836
                    , 1836, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1836, 1836, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1914, sellCostBuyPrice =sellCostBuyPrice+1836
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1836, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1836
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1836
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1836
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1914, 1836, 1836
                    , 1836, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1836, 1836, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1914, sellCostBuyPrice =sellCostBuyPrice+1836
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1836, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1836
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1836
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1836
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-09-20 22:07:25' WHERE storedetailid = '9';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('9', '1', '6', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '33', '1', '2026-09-20 22:07:25','0','0'); -- id=1234
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('417','00058', '78', '1', '58', '2', '438', '876', '0', '', '1', '2026-09-20 22:07:25', '58', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','438','876','0','','0','0.00','0','0','0','0'); -- id=527
UPDATE sellbilldetail SET  lastbuyprice = 417.00 , meanbuyprice = 417.00, lastbuyprice_withDiscount = 417.00, meanbuyprice_withDiscount = 417.00
        , lastbuyprice_withTax = 417, meanbuyprice_withTax = 417, lastbuyprice_withDiscountAndTax = 417
                where sellbilldetailid = 527;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (58, '2026-09-20', 876, 834, 834
                    , 834, 834, 834, 834
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 834, 834, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+876, sellCostBuyPrice =sellCostBuyPrice+834
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+834, sellCostMeanBuyPrice = sellCostMeanBuyPrice+834
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+834, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+834
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+834
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+834
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+834
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 876, 834, 834
                    , 834, 834, 834, 834
                    , 0, 0, 0, 0
                    , 0, 0, 0, 834, 834, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+876, sellCostBuyPrice =sellCostBuyPrice+834
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+834, sellCostMeanBuyPrice = sellCostMeanBuyPrice+834
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+834, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+834
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+834
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+834
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+834
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 22:07:26' WHERE storedetailid = '58';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('58', '1', '2', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '7', '1', '2026-09-20 22:07:26','0','0'); -- id=1235
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.44','00044', '78', '1', '44', '75', '8.8', '660', '0', '', '1', '2026-09-20 22:07:26', '44', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8.8','660','0','','0','0.00','0','0','0','0'); -- id=528
UPDATE sellbilldetail SET  lastbuyprice = 8.44 , meanbuyprice = 8.44, lastbuyprice_withDiscount = 8.44, meanbuyprice_withDiscount = 8.44
        , lastbuyprice_withTax = 8.44, meanbuyprice_withTax = 8.44, lastbuyprice_withDiscountAndTax = 8.44
                where sellbilldetailid = 528;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (44, '2026-09-20', 660, 633, 633
                    , 633, 633, 633, 633
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 633, 633, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+633
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+75
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 660, 633, 633
                    , 633, 633, 633, 633
                    , 0, 0, 0, 0
                    , 0, 0, 0, 633, 633, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+633
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+633, sellCostMeanBuyPrice = sellCostMeanBuyPrice+633
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+633, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+633
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+633
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+633
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+633
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1030', userid = '1', storedetaildate = '2026-09-20 22:07:26' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '75', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1105', '1030', '1', '2026-09-20 22:07:26','0','0'); -- id=1236
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00047', '78', '1', '47', '5', '95', '475', '0', '', '1', '2026-09-20 22:07:26', '47', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','475','0','','0','0.00','0','0','0','0'); -- id=529
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 529;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-09-20', 475, 448.5, 448.5
                    , 448.5, 448.5, 448.5, 448.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 448.5, 448.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+448.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+448.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+448.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+448.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+448.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+448.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+448.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+448.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-20', 475, 448.5, 448.5
                    , 448.5, 448.5, 448.5, 448.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 448.5, 448.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+448.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+448.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+448.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+448.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+448.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+448.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+448.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+448.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 = '104', userid = '1', storedetaildate = '2026-09-20 22:07:26' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '5', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '109', '104', '1', '2026-09-20 22:07:26','0','0'); -- id=1237
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('89.7','00046', '78', '1', '46', '4', '95', '380', '0', '', '1', '2026-09-20 22:07:27', '46', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','380','0','','0','0.00','0','0','0','0'); -- id=530
UPDATE sellbilldetail SET  lastbuyprice = 89.70 , meanbuyprice = 89.70, lastbuyprice_withDiscount = 89.70, meanbuyprice_withDiscount = 89.70
        , lastbuyprice_withTax = 89.7, meanbuyprice_withTax = 89.7, lastbuyprice_withDiscountAndTax = 89.7
                where sellbilldetailid = 530;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-09-20', 380, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+380, sellCostBuyPrice =sellCostBuyPrice+358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+358.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+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-20', 380, 358.8, 358.8
                    , 358.8, 358.8, 358.8, 358.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 358.8, 358.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+380, sellCostBuyPrice =sellCostBuyPrice+358.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+358.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+358.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+358.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+358.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+358.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+358.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+358.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 = '95', userid = '1', storedetaildate = '2026-09-20 22:07:27' WHERE storedetailid = '46';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '1', '4', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '99', '95', '1', '2026-09-20 22:07:27','0','0'); -- id=1238
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1250','00202', '78', '6', '202', '1', '1550', '1550', '0', '', '1', '2026-09-20 22:07:27', '202', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1550','1550','0','','0','0.00','0','0','0','0'); -- id=531
UPDATE sellbilldetail SET  lastbuyprice = 1250.00 , meanbuyprice = 1250.00, lastbuyprice_withDiscount = 1250.00, meanbuyprice_withDiscount = 1250.00
        , lastbuyprice_withTax = 1250, meanbuyprice_withTax = 1250, lastbuyprice_withDiscountAndTax = 1250
                where sellbilldetailid = 531;
 INSERT INTO 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-20', 1550, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1550, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1550, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-20 22:07:27' WHERE storedetailid = '202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('202', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '3', '1', '2026-09-20 22:07:27','0','0'); -- id=1239
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '78', '6', '207', '7', '15', '105', '0', '', '1', '2026-09-20 22:07:27', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','105','0','','0','0.00','0','0','0','0'); -- id=532
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 = 532;
 INSERT INTO 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-20', 105, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+105, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 105, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+105, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '138', userid = '1', storedetaildate = '2026-09-20 22:07:27' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '7', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '145', '138', '1', '2026-09-20 22:07:27','0','0'); -- id=1240
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '78', '10', '208', '1', '1210', '1210', '0', '', '1', '2026-09-20 22:07:28', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','1210','0','','0','0.00','0','0','0','0'); -- id=533
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 = 533;
 INSERT INTO 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-20', 1210, 1020, 1020
                    , 1020, 1020, 1020, 1020
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1210, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1020, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1020
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1020
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 1210, 1020, 1020
                    , 1020, 1020, 1020, 1020
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1210, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1020, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1020
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1020
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 22:07:28' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '55', '54', '1', '2026-09-20 22:07:28','0','0'); -- id=1241
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('575','00210', '78', '10', '210', '1', '675', '675', '0', '', '1', '2026-09-20 22:07:28', '210', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','675','675','0','','0','0.00','0','0','0','0'); -- id=534
UPDATE sellbilldetail SET  lastbuyprice = 575.00 , meanbuyprice = 575.00, lastbuyprice_withDiscount = 575.00, meanbuyprice_withDiscount = 575.00
        , lastbuyprice_withTax = 575, meanbuyprice_withTax = 575, lastbuyprice_withDiscountAndTax = 575
                where sellbilldetailid = 534;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (210, '2026-09-20', 675, 575, 575
                    , 575, 575, 575, 575
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 575, 575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+675, sellCostBuyPrice =sellCostBuyPrice+575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 675, 575, 575
                    , 575, 575, 575, 575
                    , 0, 0, 0, 0
                    , 0, 0, 0, 575, 575, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+675, sellCostBuyPrice =sellCostBuyPrice+575
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+575, sellCostMeanBuyPrice = sellCostMeanBuyPrice+575
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+575, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+575
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+575
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+575
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+575
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 22:07:28' WHERE storedetailid = '210';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('210', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2', '1', '1', '2026-09-20 22:07:28','0','0'); -- id=1242
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('215.25','00143', '78', '21', '143', '4', '218', '872', '0', '', '1', '2026-09-20 22:07:28', '143', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','218','872','0','','0','0.00','0','0','0','0'); -- id=535
UPDATE sellbilldetail SET  lastbuyprice = 215.25 , meanbuyprice = 215.25, lastbuyprice_withDiscount = 215.25, meanbuyprice_withDiscount = 215.25
        , lastbuyprice_withTax = 215.25, meanbuyprice_withTax = 215.25, lastbuyprice_withDiscountAndTax = 215.25
                where sellbilldetailid = 535;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (143, '2026-09-20', 872, 861, 861
                    , 861, 861, 861, 861
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 861, 861, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+872, sellCostBuyPrice =sellCostBuyPrice+861
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+861, sellCostMeanBuyPrice = sellCostMeanBuyPrice+861
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+861, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+861
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+861
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+861
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+861
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 872, 861, 861
                    , 861, 861, 861, 861
                    , 0, 0, 0, 0
                    , 0, 0, 0, 861, 861, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+872, sellCostBuyPrice =sellCostBuyPrice+861
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+861, sellCostMeanBuyPrice = sellCostMeanBuyPrice+861
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+861, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+861
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+861
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+861
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+861
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 22:07:29' WHERE storedetailid = '143';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('143', '1', '4', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '5', '1', '2026-09-20 22:07:29','0','0'); -- id=1243
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('31.86','00123', '78', '15', '123', '4', '34', '136', '0', '', '1', '2026-09-20 22:07:29', '123', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','136','0','','0','0.00','0','0','0','0'); -- id=536
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 536;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-09-20', 136, 127.44, 127.44
                    , 127.44, 127.44, 127.44, 127.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 127.44, 127.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+136, sellCostBuyPrice =sellCostBuyPrice+127.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+127.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+127.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+127.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+127.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+127.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+127.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+127.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , 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-20', 136, 127.44, 127.44
                    , 127.44, 127.44, 127.44, 127.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 127.44, 127.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+136, sellCostBuyPrice =sellCostBuyPrice+127.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+127.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+127.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+127.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+127.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+127.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+127.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+127.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '1', storedetaildate = '2026-09-20 22:07:29' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '4', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '106', '102', '1', '2026-09-20 22:07:29','0','0'); -- id=1244
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '78', '14', '81', '5', '19', '95', '0', '', '1', '2026-09-20 22:07:29', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','95','0','','0','0.00','0','0','0','0'); -- id=537
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 = 537;
 INSERT INTO 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-20', 95, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+95, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 95, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+95, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '616', userid = '1', storedetaildate = '2026-09-20 22:07:29' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '621', '616', '1', '2026-09-20 22:07:29','0','0'); -- id=1245
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '78', '14', '80', '.5', '95', '47.5', '0', '', '1', '2026-09-20 22:07:29', '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=538
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 = 538;
 INSERT INTO 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-20', 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-20', 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 = '8.75', userid = '1', storedetaildate = '2026-09-20 22:07:30' 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', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9.25', '8.75', '1', '2026-09-20 22:07:30','0','0'); -- id=1246
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.5','00419', '78', '6', '419', '1', '8', '8', '0', '', '1', '2026-09-20 22:07:30', '419', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','8','0','','0','0.00','0','0','0','0'); -- id=539
UPDATE sellbilldetail SET  lastbuyprice = 5.50 , meanbuyprice = 5.50, lastbuyprice_withDiscount = 5.50, meanbuyprice_withDiscount = 5.50
        , lastbuyprice_withTax = 5.5, meanbuyprice_withTax = 5.5, lastbuyprice_withDiscountAndTax = 5.5
                where sellbilldetailid = 539;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (419, '2026-09-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 8, 5.5, 5.5
                    , 5.5, 5.5, 5.5, 5.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5.5, 5.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8, sellCostBuyPrice =sellCostBuyPrice+5.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '64', userid = '1', storedetaildate = '2026-09-20 22:07:30' WHERE storedetailid = '419';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('419', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '65', '64', '1', '2026-09-20 22:07:30','0','0'); -- id=1247
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00420', '78', '6', '420', '1', '25', '25', '0', '', '1', '2026-09-20 22:07:30', '420', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','25','25','0','','0','0.00','0','0','0','0'); -- id=540
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 = 540;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (420, '2026-09-20', 25, 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+25, 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-20', 25, 20, 20
                    , 20, 20, 20, 20
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 20, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25, 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 = '12', userid = '1', storedetaildate = '2026-09-20 22:07:30' WHERE storedetailid = '420';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('420', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13', '12', '1', '2026-09-20 22:07:30','0','0'); -- id=1248
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','00175', '78', '19', '175', '4', '330', '1320', '0', '', '1', '2026-09-20 22:07:30', '175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','330','1320','0','','0','0.00','0','0','0','0'); -- id=541
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 541;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (175, '2026-09-20', 1320, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1320, 1300, 1300
                    , 1300, 1300, 1300, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2026-09-20 22:07:30' WHERE storedetailid = '175';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('175', '1', '4', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '40', '1', '2026-09-20 22:07:30','0','0'); -- id=1249
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('210','00196', '78', '20', '196', '1', '245', '245', '0', '', '1', '2026-09-20 22:07:31', '196', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','245','245','0','','0','0.00','0','0','0','0'); -- id=542
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
        , lastbuyprice_withTax = 210, meanbuyprice_withTax = 210, lastbuyprice_withDiscountAndTax = 210
                where sellbilldetailid = 542;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (196, '2026-09-20', 245, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+245, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 245, 210, 210
                    , 210, 210, 210, 210
                    , 0, 0, 0, 0
                    , 0, 0, 0, 210, 210, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+245, sellCostBuyPrice =sellCostBuyPrice+210
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+210, sellCostMeanBuyPrice = sellCostMeanBuyPrice+210
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+210, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+210
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+210
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+210
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+210
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '73', userid = '1', storedetaildate = '2026-09-20 22:07:31' WHERE storedetailid = '196';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('196', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '74', '73', '1', '2026-09-20 22:07:31','0','0'); -- id=1250
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('188.3','00199', '78', '20', '199', '1', '200', '200', '0', '', '1', '2026-09-20 22:07:31', '199', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','200','200','0','','0','0.00','0','0','0','0'); -- id=543
UPDATE sellbilldetail SET  lastbuyprice = 188.30 , meanbuyprice = 188.30, lastbuyprice_withDiscount = 188.30, meanbuyprice_withDiscount = 188.30
        , lastbuyprice_withTax = 188.3, meanbuyprice_withTax = 188.3, lastbuyprice_withDiscountAndTax = 188.3
                where sellbilldetailid = 543;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (199, '2026-09-20', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+188.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 200, 188.3, 188.3
                    , 188.3, 188.3, 188.3, 188.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 188.3, 188.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+200, sellCostBuyPrice =sellCostBuyPrice+188.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+188.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+188.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+188.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+188.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+188.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+188.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+188.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-09-20 22:07:31' WHERE storedetailid = '199';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('199', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '28', '27', '1', '2026-09-20 22:07:31','0','0'); -- id=1251
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('77','00211', '78', '6', '211', '1', '85', '85', '0', '', '1', '2026-09-20 22:07:31', '211', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','85','85','0','','0','0.00','0','0','0','0'); -- id=544
UPDATE sellbilldetail SET  lastbuyprice = 77.00 , meanbuyprice = 77.00, lastbuyprice_withDiscount = 77.00, meanbuyprice_withDiscount = 77.00
        , lastbuyprice_withTax = 77, meanbuyprice_withTax = 77, lastbuyprice_withDiscountAndTax = 77
                where sellbilldetailid = 544;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (211, '2026-09-20', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 85, 77, 77
                    , 77, 77, 77, 77
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77, 77, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85, sellCostBuyPrice =sellCostBuyPrice+77
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-09-20 22:07:32' WHERE storedetailid = '211';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('211', '1', '1', '1', '78', 'اضافة فاتورة مبيعات', 'sellbillController.php', '34', '33', '1', '2026-09-20 22:07:32','0','0'); -- id=1252
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-182479.374375',  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 ('-203785.234375','21305.86', '0', '1', 'اضافة فاتورة مبيعات', '78', '-182479.374375', '2026-09-20 22:07:32', '1',  'sellbillController.php','1','','0'); -- id=73
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21305.86', '21305.86', '2026-09-20', '1', '0', '0', '2026-09-20 22:07:32','اضافة فاتورة مبيعات رقم 78','1','0',null,'0','78','sellbillController.php?do=showDetail&sellbillid=78'); -- id=694
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('694', '383', '21305.86', '','0'); -- id=694
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-135787.37', 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 ('694', '143', '21305.86', '','0'); -- id=694
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '250378.95', 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 ( '19986.72', '19986.72', '2026-09-20', '1', '0', '0', '2026-09-20 22:07:32','اضافة فاتورة مبيعات رقم 78 - صرف البضاعة من المخزن','1','0',null,'0','78','sellbillController.php?do=showDetail&sellbillid=78'); -- id=695
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('695', '402', '19986.72', '','0'); -- id=695
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '234257.02', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('695', '382', '19986.72', '','0'); -- id=695
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2130877.05', 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='694,0,695' where sellbillid=78;
 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-20', 21305.86, 19986.72, 19986.72
                    , 19986.72, 19986.72, 19986.72, 19986.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19986.72, 19986.72, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21305.86, sellCostBuyPrice =sellCostBuyPrice+19986.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19986.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19986.72
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19986.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19986.72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19986.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19986.72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19986.72
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 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-20', 21305.86, 19986.72, 19986.72
                    , 19986.72, 19986.72, 19986.72, 19986.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19986.72, 19986.72, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21305.86, sellCostBuyPrice =sellCostBuyPrice+19986.72
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19986.72, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19986.72
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19986.72, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19986.72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19986.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19986.72
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19986.72
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 21305.86, 19986.72, 19986.72
                    , 19986.72, 19986.72, 19986.72, 19986.72, 19986.72, 19986.72)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+21305.86, netSellCostBuyPrice = netSellCostBuyPrice+19986.72
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+19986.72
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+19986.72
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+19986.72
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+19986.72
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+19986.72
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+19986.72
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+19986.72;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06aafa27e66c97 and sellbillId = 78 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:37:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:07:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:07:34', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1814
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:39:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:09:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:09:16', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1815
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:40:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:10:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:10:05', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=78'); -- id=1816
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:44:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:14:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:14:56', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1817
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:45:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:15:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:15:09', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1818
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:45:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:15:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:15:14', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=67'); -- id=1819
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:45:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:15:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:15:27', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1820
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 67;
UPDATE sellbill SET  sellbillsysdate = '2026-09-20 22:15:27', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '67';
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 434;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (422, '2026-09-20', 945, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0,60,0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-945, sellCostBuyPrice =sellCostBuyPrice-900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-900, sellCostMeanBuyPrice = sellCostMeanBuyPrice-900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-900
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-60
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 945, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-945, sellCostBuyPrice =sellCostBuyPrice-900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-900, sellCostMeanBuyPrice = sellCostMeanBuyPrice-900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-900
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '80', userid = '1', storedetaildate = '2026-09-20 22:15:27' WHERE storedetailid = '422';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('422', '1', '60', '0', '67', 'تعديل فاتورة مبيعات', 'sellbillController.php', '20', '80', '1', '2026-09-20 12:19:28','0','0'); -- id=1253
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 435;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (421, '2026-09-20', 540, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-540, sellCostBuyPrice =sellCostBuyPrice-450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-450, sellCostMeanBuyPrice = sellCostMeanBuyPrice-450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-450
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 540, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-540, sellCostBuyPrice =sellCostBuyPrice-450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-450, sellCostMeanBuyPrice = sellCostMeanBuyPrice-450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-450
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 22:15:28' WHERE storedetailid = '421';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('421', '1', '6', '0', '67', 'تعديل فاتورة مبيعات', 'sellbillController.php', '14', '20', '1', '2026-09-20 12:19:28','0','0'); -- id=1254
UPDATE sellbilldetail SET  lastbuyprice = 78.75 , meanbuyprice = 78.75, lastbuyprice_withDiscount = 78.75, meanbuyprice_withDiscount = 78.75
        , lastbuyprice_withTax = 78.75, meanbuyprice_withTax = 78.75, lastbuyprice_withDiscountAndTax = 78.75
                where sellbilldetailid = 436;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (141, '2026-09-20', 800, 787.5, 787.5
                    , 787.5, 787.5, 787.5, 787.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 787.5, 787.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-800, sellCostBuyPrice =sellCostBuyPrice-787.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-787.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-787.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-787.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-787.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-787.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-787.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-787.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-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-20', 800, 787.5, 787.5
                    , 787.5, 787.5, 787.5, 787.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 787.5, 787.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-800, sellCostBuyPrice =sellCostBuyPrice-787.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-787.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-787.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-787.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-787.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-787.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-787.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-787.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 = '32', userid = '1', storedetaildate = '2026-09-20 22:15:28' WHERE storedetailid = '141';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('141', '1', '10', '0', '67', 'تعديل فاتورة مبيعات', 'sellbillController.php', '22', '32', '1', '2026-09-20 12:19:28','0','0'); -- id=1255
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 3;
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 437;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (90, '2026-09-20', 47.5, 43.65, 43.65
                    , 43.65, 43.65, 43.65, 43.65
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 43.65, 43.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.5, sellCostBuyPrice =sellCostBuyPrice-43.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-43.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice-43.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-43.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-43.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-43.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-43.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-43.65
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-20', 47.5, 43.65, 43.65
                    , 43.65, 43.65, 43.65, 43.65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 43.65, 43.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-47.5, sellCostBuyPrice =sellCostBuyPrice-43.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-43.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice-43.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-43.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-43.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-43.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-43.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-43.65
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-09-20 22:15:28' WHERE storedetailid = '90';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '1', '5', '0', '67', 'تعديل فاتورة مبيعات', 'sellbillController.php', '45', '50', '1', '2026-09-20 12:19:28','0','0'); -- id=1256
UPDATE sellbilldetail SET  lastbuyprice = 4.85 , meanbuyprice = 4.85, lastbuyprice_withDiscount = 4.85, meanbuyprice_withDiscount = 4.85
        , lastbuyprice_withTax = 4.85, meanbuyprice_withTax = 4.85, lastbuyprice_withDiscountAndTax = 4.85
                where sellbilldetailid = 438;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (96, '2026-09-20', 27.5, 24.25, 24.25
                    , 24.25, 24.25, 24.25, 24.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 24.25, 24.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-27.5, sellCostBuyPrice =sellCostBuyPrice-24.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-24.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-24.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-24.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-24.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-24.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-24.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-24.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 27.5, 24.25, 24.25
                    , 24.25, 24.25, 24.25, 24.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24.25, 24.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-27.5, sellCostBuyPrice =sellCostBuyPrice-24.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-24.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-24.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-24.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-24.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-24.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-24.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-24.25
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-20 22:15:28' WHERE storedetailid = '96';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('96', '1', '5', '0', '67', 'تعديل فاتورة مبيعات', 'sellbillController.php', '-5', '0', '1', '2026-09-20 12:19:28','0','0'); -- id=1257
UPDATE sellbilldetail SET  lastbuyprice = 55.50 , meanbuyprice = 55.50, lastbuyprice_withDiscount = 55.50, meanbuyprice_withDiscount = 55.50
        , lastbuyprice_withTax = 55.5, meanbuyprice_withTax = 55.5, lastbuyprice_withDiscountAndTax = 55.5
                where sellbilldetailid = 439;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (177, '2026-09-20', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-580, sellCostBuyPrice =sellCostBuyPrice-555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-555, sellCostMeanBuyPrice = sellCostMeanBuyPrice-555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-555
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-580, sellCostBuyPrice =sellCostBuyPrice-555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-555, sellCostMeanBuyPrice = sellCostMeanBuyPrice-555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-555
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '131', userid = '1', storedetaildate = '2026-09-20 22:15:28' WHERE storedetailid = '177';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('177', '1', '10', '0', '67', 'تعديل فاتورة مبيعات', 'sellbillController.php', '121', '131', '1', '2026-09-20 12:19:28','0','0'); -- id=1258
CALL clientInUse(3,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '895', userid = '1' WHERE clientid = '3';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('3','3835.00','2940.00','1','تعديل فاتورة مبيعات','67', '895', '2026-09-20 12:19:28', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '2940', '0', null, '0', null, null,'', '0','1','1','2940','1','2026-09-20 12:19:28','0','0','',''); -- id=126
UPDATE client SET  inUse = 0 where clientid = 3;
 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-20', 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2760.4, 2760.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2940, sellCostBuyPrice =sellCostBuyPrice-2760.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2760.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2760.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2760.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2760.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2760.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2760.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2760.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-09-20', 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760.4, 2760.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2940, sellCostBuyPrice =sellCostBuyPrice-2760.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2760.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2760.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2760.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2760.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2760.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2760.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2760.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4, 2760.4, 2760.4)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-2940, netSellCostBuyPrice = netSellCostBuyPrice-2760.4
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-2760.4
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-2760.4
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-2760.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-2760.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-2760.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-2760.4
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-2760.4;

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


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

COMMIT;
BEGIN;
CALL clientInUse(3,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-20 12:19:28', '06aafa8386d4c8', '3', '895.00', '3835', '0', '1', '2940', '2940', '0', '2940', '1', '2026-09-20 12:19:28', '', '1', '0', 'عبدالحي الشاذلي ', '1', '1', '3', '0', '3 - عبدالحي الشاذلي ', '96', '67', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=79
UPDATE client SET  clientdebt = '3835', userid = '1' WHERE clientid = '3';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('3','895.00','2940','0','اضافة فاتورة مبيعات (معدله)','79', '3835', '2026-09-20 22:15:29', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '2940', '0', null, '0', null, null,'', '0','1','1','2940','1','2026-09-20 12:19:28','0','0','',''); -- id=127
UPDATE client SET  inUse = 0 where clientid = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('15','00422', '79', '3', '422', '60.00', '15.75', '945', '0', '', '1', '2026-09-20 22:15:29', '422', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15.75','945','0','','0','0.00','0','0','0','0'); -- id=545
UPDATE sellbilldetail SET  lastbuyprice = 15.00 , meanbuyprice = 15.00, lastbuyprice_withDiscount = 15.00, meanbuyprice_withDiscount = 15.00
        , lastbuyprice_withTax = 15, meanbuyprice_withTax = 15, lastbuyprice_withDiscountAndTax = 15
                where sellbilldetailid = 545;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (422, '2026-09-20', 945, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+945, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+60
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 945, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+945, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-09-20 22:15:29' WHERE storedetailid = '422';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('422', '1', '60', '1', '79', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '80', '20', '1', '2026-09-20 22:15:29','0','0'); -- id=1259
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('75','00421', '79', '6', '421', '6.00', '90', '540', '0', '', '1', '2026-09-20 22:15:29', '421', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','90','540','0','','0','0.00','0','0','0','0'); -- id=546
UPDATE sellbilldetail SET  lastbuyprice = 75.00 , meanbuyprice = 75.00, lastbuyprice_withDiscount = 75.00, meanbuyprice_withDiscount = 75.00
        , lastbuyprice_withTax = 75, meanbuyprice_withTax = 75, lastbuyprice_withDiscountAndTax = 75
                where sellbilldetailid = 546;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (421, '2026-09-20', 540, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 540, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+540, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2026-09-20 22:15:30' WHERE storedetailid = '421';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('421', '1', '6', '1', '79', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '20', '14', '1', '2026-09-20 22:15:30','0','0'); -- id=1260
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('78.75','00141', '79', '21', '141', '10.00', '80', '800', '0', '', '1', '2026-09-20 22:15:30', '141', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','80','800','0','','0','0.00','0','0','0','0'); -- id=547
UPDATE sellbilldetail SET  lastbuyprice = 78.75 , meanbuyprice = 78.75, lastbuyprice_withDiscount = 78.75, meanbuyprice_withDiscount = 78.75
        , lastbuyprice_withTax = 78.75, meanbuyprice_withTax = 78.75, lastbuyprice_withDiscountAndTax = 78.75
                where sellbilldetailid = 547;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (141, '2026-09-20', 800, 787.5, 787.5
                    , 787.5, 787.5, 787.5, 787.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 787.5, 787.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+787.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+787.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+787.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+787.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+787.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+787.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+787.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+787.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+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-20', 800, 787.5, 787.5
                    , 787.5, 787.5, 787.5, 787.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 787.5, 787.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+787.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+787.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+787.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+787.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+787.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+787.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+787.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+787.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 = '22', userid = '1', storedetaildate = '2026-09-20 22:15:30' WHERE storedetailid = '141';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('141', '1', '10', '1', '79', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '22', '1', '2026-09-20 22:15:30','0','0'); -- id=1261
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.73','00090', '79', '18', '90', '5.00', '9.5', '47.5', '0', '', '1', '2026-09-20 22:15:30', '90', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','3-5,','1','1','0','0','9.5','47.5','0','','0','0.00','0','0','0','0'); -- id=548
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 548;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (90, '2026-09-20', 47.5, 43.65, 43.65
                    , 43.65, 43.65, 43.65, 43.65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 43.65, 43.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+43.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+43.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+43.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+43.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+43.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+43.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+43.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+43.65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 47.5, 43.65, 43.65
                    , 43.65, 43.65, 43.65, 43.65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 43.65, 43.65, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+47.5, sellCostBuyPrice =sellCostBuyPrice+43.65
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+43.65, sellCostMeanBuyPrice = sellCostMeanBuyPrice+43.65
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+43.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+43.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+43.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+43.65
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+43.65
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-09-20 22:15:30' WHERE storedetailid = '90';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('90', '1', '5', '1', '79', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '50', '45', '1', '2026-09-20 22:15:30','0','0'); -- id=1262
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('4.85','00096', '79', '18', '96', '5.00', '5.5', '27.5', '0', '', '1', '2026-09-20 22:15:30', '96', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','5.5','27.5','0','','0','0.00','0','0','0','0'); -- id=549
UPDATE sellbilldetail SET  lastbuyprice = 4.85 , meanbuyprice = 4.85, lastbuyprice_withDiscount = 4.85, meanbuyprice_withDiscount = 4.85
        , lastbuyprice_withTax = 4.85, meanbuyprice_withTax = 4.85, lastbuyprice_withDiscountAndTax = 4.85
                where sellbilldetailid = 549;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (96, '2026-09-20', 27.5, 24.25, 24.25
                    , 24.25, 24.25, 24.25, 24.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 24.25, 24.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27.5, sellCostBuyPrice =sellCostBuyPrice+24.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 27.5, 24.25, 24.25
                    , 24.25, 24.25, 24.25, 24.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24.25, 24.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27.5, sellCostBuyPrice =sellCostBuyPrice+24.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-5', userid = '1', storedetaildate = '2026-09-20 22:15:31' WHERE storedetailid = '96';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('96', '1', '5', '1', '79', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '0', '-5', '1', '2026-09-20 22:15:31','0','0'); -- id=1263
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('55.5','00177', '79', '19', '177', '10.00', '58', '580', '0', '', '1', '2026-09-20 22:15:31', '177', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','58','580','0','','0','0.00','0','0','0','0'); -- id=550
UPDATE sellbilldetail SET  lastbuyprice = 55.50 , meanbuyprice = 55.50, lastbuyprice_withDiscount = 55.50, meanbuyprice_withDiscount = 55.50
        , lastbuyprice_withTax = 55.5, meanbuyprice_withTax = 55.5, lastbuyprice_withDiscountAndTax = 55.5
                where sellbilldetailid = 550;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (177, '2026-09-20', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+555
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 580, 555, 555
                    , 555, 555, 555, 555
                    , 0, 0, 0, 0
                    , 0, 0, 0, 555, 555, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+580, sellCostBuyPrice =sellCostBuyPrice+555
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+555, sellCostMeanBuyPrice = sellCostMeanBuyPrice+555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+555, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+555
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+555
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+555
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+555
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 22:15:31' WHERE storedetailid = '177';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('177', '1', '10', '1', '79', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '131', '121', '1', '2026-09-20 22:15:31','0','0'); -- id=1264
UPDATE dailyentry SET totalcreditor = '2940.00', totaldebtor = '2940.00', thedate = '2026-09-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-20 12:19:31', entryComment = 'اضافة فاتورة مبيعات رقم 67', fromFlag = '1',related='0',isopeningentry='0',operationId='67',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=67' WHERE id = '651';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2940.00', '2940.00', '2026-09-20', '1', '0', '651', '2026-09-20 22:15:31','تم عكس القيد رقم 651 ','1','0','0','0','0',''); -- id=696
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('696', '427', '2940.00', '','0'); -- id=696
UPDATE accountstree SET name = 'عبدالحي الشاذلي ', customName = 'عبدالحي الشاذلي ', customNameEn = 'عبدالحي الشاذلي ', nameEn = 'عبدالحي الشاذلي ', parent = '58', accountNature = '0', theValue = '895', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-14 13:19:31' WHERE id = '427';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('696', '143', '2940.00', '','0'); -- id=696
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '247438.95', 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 = '2760.40', totaldebtor = '2760.40', thedate = '2026-09-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-20 12:19:31', entryComment = 'اضافة فاتورة مبيعات رقم 67 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='67',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=67' WHERE id = '652';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2760.40', '2760.40', '2026-09-20', '1', '0', '652', '2026-09-20 22:15:32','تم عكس القيد رقم 652 ','1','0','0','0','0',''); -- id=697
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('697', '402', '2760.40', '','0'); -- id=697
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '231496.62', 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 ('697', '382', '2760.40', '','0'); -- id=697
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2133637.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2940', '2940', '2026-09-20', '1', '0', '0', '2026-09-20 22:15:32','اضافة فاتورة مبيعات رقم 79','1','0',null,'0','79','sellbillController.php?do=showDetail&sellbillid=79'); -- id=698
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('698', '427', '2940', '','0'); -- id=698
UPDATE accountstree SET name = 'عبدالحي الشاذلي ', customName = 'عبدالحي الشاذلي ', customNameEn = 'عبدالحي الشاذلي ', nameEn = 'عبدالحي الشاذلي ', parent = '58', accountNature = '0', theValue = '3835', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-14 13:19:31' WHERE id = '427';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('698', '143', '2940', '','0'); -- id=698
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '250378.95', 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 ( '2760.4', '2760.4', '2026-09-20', '1', '0', '0', '2026-09-20 22:15:32','اضافة فاتورة مبيعات رقم 79 - صرف البضاعة من المخزن','1','0',null,'0','79','sellbillController.php?do=showDetail&sellbillid=79'); -- id=699
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('699', '402', '2760.4', '','0'); -- id=699
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '234257.02', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('699', '382', '2760.4', '','0'); -- id=699
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2130877.05', 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='698,0,699' where sellbillid=79;
 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-20', 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2760.4, 2760.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2760.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-09-20', 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2760.4, 2760.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940, sellCostBuyPrice =sellCostBuyPrice+2760.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 2940, 2760.4, 2760.4
                    , 2760.4, 2760.4, 2760.4, 2760.4, 2760.4, 2760.4)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2940, netSellCostBuyPrice = netSellCostBuyPrice+2760.4
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2760.4
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2760.4
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2760.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2760.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2760.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2760.4
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2760.4;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 67 and newid=79 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:45:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:15:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:15:33', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=79'); -- id=1821
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:45:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:15:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 22:15:54', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=1822
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:46:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:16:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-20 22:16:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=1823
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 18:48:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:18:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:18:58', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1824
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 19:23:12";
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-20 19:23:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:53:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-20 22:53:23', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=1825
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-20 19:23:29";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-20 22:53:29', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=1826
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 19:23:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 22:53:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 22:53:36', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1827
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid,taxnumber,password,clientTypeForTree,treeId,husbandNameObgy,txtNameE,facility,delegate,txtemail,commercial,valtaxnumber,clientaddress2,country,delegateid,datecustomeraccount,taxfile,fileimg,webStoreType,clientaddress3,tagids,email_verified,email_otp,email_otp_expiry) VALUES ('اسامه صلاح ' , '', '', '', '0', '', '0', '2026-09-20 22:53:57', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-20','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=22
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('22', '0', '0', '', ''); -- id=22
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 ('22','0','0','0','إضافة عميل جديد','22', '0', '2026-09-20 22:53:57', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=128
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-20 22:53:58'); -- id=451
UPDATE client SET clientname = 'اسامه صلاح ', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-20', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '.',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',webApiId ='0' ,clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0', taxnumber='', password='',clientTypeForTree='0',treeId='451',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 = '22';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 19:40:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:10:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:10:06', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1828
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 19:44:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:14:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:14:12', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1829
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 19:44:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:14:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:14:29', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=1830

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab047d34dd99
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(22,@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-20 23:14:29', '06ab047d34dd99', '22', '0.00', '14444.8', '0', '1', '14444.80', '14444.8', '0', '14444.8', '1', '2026-09-20 23:14:29', '', '1', '0', 'اسامه صلاح ', '1', '1', '3', '0', 'اسامه صلاح ', '390' ,'0','','','','','-1','0','0','0','0','0','14444','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=80
UPDATE client SET  clientdebt = '14444.8', userid = '1' WHERE clientid = '22';
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 ('22','0.00','14444.8','0','اضافة فاتورة مبيعات','80', '14444.8', '2026-09-20 23:14:30', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14444.8', '0', null, '0', null, null,'', '0','1','1','14444.8','1','2026-09-20 23:14:29','0','0','',''); -- id=129
UPDATE client SET  inUse = 0 where clientid = 22;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.79','00355', '80', '1', '355', '110', '54.78', '6025.8', '0', '', '1', '2026-09-20 23:14:30', '355', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54.78','6025.8','0','','0','0.00','0','0','0','0'); -- id=551
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 551;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (355, '2026-09-20', 6025.8, 5806.9, 5806.9
                    , 5806.9, 5806.9, 5806.9, 5806.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 110, 0, 5806.9, 5806.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6025.8, sellCostBuyPrice =sellCostBuyPrice+5806.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5806.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5806.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5806.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5806.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5806.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5806.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5806.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+110
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 6025.8, 5806.9, 5806.9
                    , 5806.9, 5806.9, 5806.9, 5806.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5806.9, 5806.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6025.8, sellCostBuyPrice =sellCostBuyPrice+5806.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5806.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5806.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5806.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5806.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5806.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5806.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5806.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 = '72', userid = '1', storedetaildate = '2026-09-20 23:14:30' WHERE storedetailid = '355';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('355', '1', '110', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '182', '72', '1', '2026-09-20 23:14:30','0','0'); -- id=1265
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00360', '80', '1', '360', '120', '10.95', '1314', '0', '', '1', '2026-09-20 23:14:30', '360', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','1314','0','','0','0.00','0','0','0','0'); -- id=552
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 = 552;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (360, '2026-09-20', 1314, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1314, sellCostBuyPrice =sellCostBuyPrice+1266
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1266, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1266
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1266
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1266
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1266
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+120
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1314, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1314, sellCostBuyPrice =sellCostBuyPrice+1266
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1266, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1266
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1266
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1266
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1266
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:14:31' WHERE storedetailid = '360';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('360', '1', '120', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '289', '169', '1', '2026-09-20 23:14:31','0','0'); -- id=1266
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00356', '80', '1', '356', '75', '36', '2700', '0', '', '1', '2026-09-20 23:14:31', '356', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','2700','0','','0','0.00','0','0','0','0'); -- id=553
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 = 553;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (356, '2026-09-20', 2700, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+75
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2700, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:14:31' WHERE storedetailid = '356';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('356', '1', '75', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '244', '169', '1', '2026-09-20 23:14:31','0','0'); -- id=1267
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00357', '80', '1', '357', '65', '36', '2340', '0', '', '1', '2026-09-20 23:14:31', '357', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','2340','0','','0','0.00','0','0','0','0'); -- id=554
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 = 554;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (357, '2026-09-20', 2340, 2262, 2262
                    , 2262, 2262, 2262, 2262
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 0, 2262, 2262, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2262
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2262, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2262
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2262, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2262
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2262
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2262
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2262
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+65
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2340, 2262, 2262
                    , 2262, 2262, 2262, 2262
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2262, 2262, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2262
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2262, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2262
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2262, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2262
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2262
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2262
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2262
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '186', userid = '1', storedetaildate = '2026-09-20 23:14:31' WHERE storedetailid = '357';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('357', '1', '65', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '251', '186', '1', '2026-09-20 23:14:31','0','0'); -- id=1268
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('95','00362', '80', '1', '362', '2', '98', '196', '0', '', '1', '2026-09-20 23:14:32', '362', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','98','196','0','','0','0.00','0','0','0','0'); -- id=555
UPDATE sellbilldetail SET  lastbuyprice = 95.00 , meanbuyprice = 95.00, lastbuyprice_withDiscount = 95.00, meanbuyprice_withDiscount = 95.00
        , lastbuyprice_withTax = 95, meanbuyprice_withTax = 95, lastbuyprice_withDiscountAndTax = 95
                where sellbilldetailid = 555;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (362, '2026-09-20', 196, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+196, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 196, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+196, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:14:32' WHERE storedetailid = '362';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('362', '1', '2', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '19', '1', '2026-09-20 23:14:32','0','0'); -- id=1269
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00358', '80', '1', '358', '5', '109', '545', '0', '', '1', '2026-09-20 23:14:32', '358', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','109','545','0','','0','0.00','0','0','0','0'); -- id=556
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 = 556;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (358, '2026-09-20', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-09-20 23:14:32' WHERE storedetailid = '358';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('358', '1', '5', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '26', '21', '1', '2026-09-20 23:14:32','0','0'); -- id=1270
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00359', '80', '1', '359', '8', '106', '848', '0', '', '1', '2026-09-20 23:14:32', '359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','106','848','0','','0','0.00','0','0','0','0'); -- id=557
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 = 557;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (359, '2026-09-20', 848, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+848, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 848, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+848, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2026-09-20 23:14:33' WHERE storedetailid = '359';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('359', '1', '8', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '17', '1', '2026-09-20 23:14:33','0','0'); -- id=1271
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.46','00365', '80', '1', '365', '2', '87', '174', '0', '', '1', '2026-09-20 23:14:33', '365', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','87','174','0','','0','0.00','0','0','0','0'); -- id=558
UPDATE sellbilldetail SET  lastbuyprice = 84.46 , meanbuyprice = 84.46, lastbuyprice_withDiscount = 84.46, meanbuyprice_withDiscount = 84.46
        , lastbuyprice_withTax = 84.46, meanbuyprice_withTax = 84.46, lastbuyprice_withDiscountAndTax = 84.46
                where sellbilldetailid = 558;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (365, '2026-09-20', 174, 168.92, 168.92
                    , 168.92, 168.92, 168.92, 168.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 168.92, 168.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+174, sellCostBuyPrice =sellCostBuyPrice+168.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+168.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+168.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+168.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+168.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+168.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+168.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+168.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+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-20', 174, 168.92, 168.92
                    , 168.92, 168.92, 168.92, 168.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 168.92, 168.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+174, sellCostBuyPrice =sellCostBuyPrice+168.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+168.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+168.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+168.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+168.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+168.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+168.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+168.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 = '36', userid = '1', storedetaildate = '2026-09-20 23:14:33' WHERE storedetailid = '365';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('365', '1', '2', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '38', '36', '1', '2026-09-20 23:14:33','0','0'); -- id=1272
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00367', '80', '1', '367', '2', '66', '132', '0', '', '1', '2026-09-20 23:14:33', '367', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','66','132','0','','0','0.00','0','0','0','0'); -- id=559
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 = 559;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (367, '2026-09-20', 132, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+132, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 132, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+132, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-09-20 23:14:33' WHERE storedetailid = '367';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('367', '1', '2', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '30', '1', '2026-09-20 23:14:33','0','0'); -- id=1273
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00363', '80', '1', '363', '1', '170', '170', '0', '', '1', '2026-09-20 23:14:33', '363', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','170','170','0','','0','0.00','0','0','0','0'); -- id=560
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 = 560;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (363, '2026-09-20', 170, 163, 163
                    , 163, 163, 163, 163
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 163, 163, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+163
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+163, sellCostMeanBuyPrice = sellCostMeanBuyPrice+163
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+163, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+163
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+163
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+163
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+163
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 170, 163, 163
                    , 163, 163, 163, 163
                    , 0, 0, 0, 0
                    , 0, 0, 0, 163, 163, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+163
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+163, sellCostMeanBuyPrice = sellCostMeanBuyPrice+163
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+163, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+163
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+163
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+163
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+163
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:14:34' WHERE storedetailid = '363';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('363', '1', '1', '1', '80', 'اضافة فاتورة مبيعات', 'sellbillController.php', '31', '30', '1', '2026-09-20 23:14:34','0','0'); -- id=1274
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14444.8', '14444.8', '2026-09-20', '1', '0', '0', '2026-09-20 23:14:34','اضافة فاتورة مبيعات رقم 80','1','0',null,'0','80','sellbillController.php?do=showDetail&sellbillid=80'); -- id=700
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('700', '451', '14444.8', '','0'); -- id=700
UPDATE accountstree SET name = 'اسامه صلاح ', customName = 'اسامه صلاح ', customNameEn = 'اسامه صلاح ', nameEn = 'اسامه صلاح ', parent = '58', accountNature = '0', theValue = '14444.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 22:53:58' WHERE id = '451';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('700', '143', '14444.8', '','0'); -- id=700
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '264823.75', 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 ( '13957.82', '13957.82', '2026-09-20', '1', '0', '0', '2026-09-20 23:14:34','اضافة فاتورة مبيعات رقم 80 - صرف البضاعة من المخزن','1','0',null,'0','80','sellbillController.php?do=showDetail&sellbillid=80'); -- id=701
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('701', '402', '13957.82', '','0'); -- id=701
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '248214.84', 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 ('701', '382', '13957.82', '','0'); -- id=701
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2116919.23', 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='700,0,701' where sellbillid=80;
 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-20', 14444.8, 13957.82, 13957.82
                    , 13957.82, 13957.82, 13957.82, 13957.82
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13957.82, 13957.82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14444.8, sellCostBuyPrice =sellCostBuyPrice+13957.82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13957.82, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13957.82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13957.82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13957.82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13957.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13957.82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13957.82
                        , returnSellVal = returnSellVal+0, 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 (22, '2026-09-20', 14444.8, 13957.82, 13957.82
                    , 13957.82, 13957.82, 13957.82, 13957.82
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13957.82, 13957.82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14444.8, sellCostBuyPrice =sellCostBuyPrice+13957.82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13957.82, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13957.82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13957.82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13957.82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13957.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13957.82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13957.82
                        , returnSellVal = returnSellVal+0, 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, 14444.8, 13957.82, 13957.82
                    , 13957.82, 13957.82, 13957.82, 13957.82, 13957.82, 13957.82)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14444.8, netSellCostBuyPrice = netSellCostBuyPrice+13957.82
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+13957.82
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+13957.82
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+13957.82
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13957.82
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+13957.82
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+13957.82
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+13957.82;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab047d34dd99 and sellbillId = 80 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 19:44:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:14:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:14:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=1831
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:07: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-20 20:07:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:37:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-20 23:37:58', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=1832
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-20 20:08:04";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-20 23:38:04', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=1833
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:08:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:38:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:38:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1834
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:08:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:38:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:38:27', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=1835
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:08:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:38:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:38:34', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=80'); -- id=1836
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:09:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:39:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 23:39:01', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1837
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:10:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:40:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 23:40:33', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=1838
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('وصله ماجنتيك ','','8','40','45','45','45','2026-09-20','0','1','0','','0','0','0','0','0','40','40','40','40','40','0','12.5','12.5','12.5','.','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=431
UPDATE product SET productName = 'وصله ماجنتيك ', productDescription = '', productCatId = '8', productBuyPrice = '40', productSellAllPrice = '45', productSellUnitPrice = '45', productSellHalfPrice = '45', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00431',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 = '12.5' , buyhalf_precentage = '12.5' , buypart_precentage = '12.5',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 = '431';
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', '431', '1.00', '2026-09-20', '1', '0','0043101','45','45','45','40','','0','0','0','0','0','0','0','0','0','0'); -- id=431
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('431', '1', '5', '1', '2026-09-20'); -- id=431
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('431', '1', '5', '0', '431', 'إضافة منتج', 'productController.php', '0', '5', '1', '2026-09-20','0','0'); -- id=1275
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (431, 1,'2026-09-20 23:40:34',1)
                ON DUPLICATE KEY UPDATE productid = 431, edited = 1, sysdate = '2026-09-20 23:40:34', userid = 1; -- id=536
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '200', '200', '2026-09-20', '1', '0', '0', '2026-09-20 23:40:34','إضافة منتج وصله ماجنتيك  الكمية 5','1','0','0','0','431','productController.php?do=edit&id=431'); -- id=702
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('702', '382', '200', '','0'); -- id=702
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2117119.23', 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 ('702', '121', '200', '','0'); -- id=702
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1177727.37', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'وصله ماجنتيك ', productDescription = '', productCatId = '8', productBuyPrice = '40.00', productSellAllPrice = '45.00', productSellUnitPrice = '45.00', productSellHalfPrice = '45.00', productDate = '2026-09-20', conditions = '0', userId = '1', limitamount = '0', parcode = '00431',type ='0', expireDate = '0' , dailyentryId = '702',isService = '0',isOptic = '0',lastbuyprice = '40',lastbuyprice_withDiscount = '40',meanbuyprice = '40',meanbuyprice_withDiscount = '40' , productbuypricereal = '40' , buypricereal_precentage = '0' , buytotal_precentage = '12.5' , buyhalf_precentage = '12.5' , buypart_precentage = '12.5',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 = '431';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:10:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:40:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-20 23:40:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=1839
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:10:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:40:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:40:54', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=1840
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 80;
UPDATE sellbill SET  sellbillsysdate = '2026-09-20 23:40:54', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '80';
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 551;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (355, '2026-09-20', 6025.8, 5806.9, 5806.9
                    , 5806.9, 5806.9, 5806.9, 5806.9
                    , 0, 0, 0, 0
                    , 0, 0, 0,110,0, 5806.9, 5806.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6025.8, sellCostBuyPrice =sellCostBuyPrice-5806.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5806.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5806.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5806.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5806.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5806.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5806.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5806.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-110
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 6025.8, 5806.9, 5806.9
                    , 5806.9, 5806.9, 5806.9, 5806.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5806.9, 5806.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6025.8, sellCostBuyPrice =sellCostBuyPrice-5806.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5806.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5806.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5806.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5806.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5806.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5806.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5806.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 = '182', userid = '1', storedetaildate = '2026-09-20 23:40:54' WHERE storedetailid = '355';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('355', '1', '110', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '72', '182', '1', '2026-09-20 23:14:29','0','0'); -- id=1276
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 = 552;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (360, '2026-09-20', 1314, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0,120,0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1314, sellCostBuyPrice =sellCostBuyPrice-1266
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1266, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1266
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1266
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1266
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1266
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-120
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1314, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1314, sellCostBuyPrice =sellCostBuyPrice-1266
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1266, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1266
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1266
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1266
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1266
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '289', userid = '1', storedetaildate = '2026-09-20 23:40:54' WHERE storedetailid = '360';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('360', '1', '120', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '169', '289', '1', '2026-09-20 23:14:29','0','0'); -- id=1277
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 = 553;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (356, '2026-09-20', 2700, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0,75,0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2700, sellCostBuyPrice =sellCostBuyPrice-2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2610
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-75
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2700, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2700, sellCostBuyPrice =sellCostBuyPrice-2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2610
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '244', userid = '1', storedetaildate = '2026-09-20 23:40:54' WHERE storedetailid = '356';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('356', '1', '75', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '169', '244', '1', '2026-09-20 23:14:29','0','0'); -- id=1278
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 = 554;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (357, '2026-09-20', 2340, 2262, 2262
                    , 2262, 2262, 2262, 2262
                    , 0, 0, 0, 0
                    , 0, 0, 0,65,0, 2262, 2262, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2340, sellCostBuyPrice =sellCostBuyPrice-2262
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2262, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2262
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2262, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2262
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2262
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2262
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2262
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-65
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2340, 2262, 2262
                    , 2262, 2262, 2262, 2262
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2262, 2262, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2340, sellCostBuyPrice =sellCostBuyPrice-2262
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2262, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2262
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2262, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2262
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2262
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2262
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2262
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '251', userid = '1', storedetaildate = '2026-09-20 23:40:55' WHERE storedetailid = '357';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('357', '1', '65', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '186', '251', '1', '2026-09-20 23:14:29','0','0'); -- id=1279
UPDATE sellbilldetail SET  lastbuyprice = 95.00 , meanbuyprice = 95.00, lastbuyprice_withDiscount = 95.00, meanbuyprice_withDiscount = 95.00
        , lastbuyprice_withTax = 95, meanbuyprice_withTax = 95, lastbuyprice_withDiscountAndTax = 95
                where sellbilldetailid = 555;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (362, '2026-09-20', 196, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-196, sellCostBuyPrice =sellCostBuyPrice-190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-190, sellCostMeanBuyPrice = sellCostMeanBuyPrice-190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-190
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 196, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-196, sellCostBuyPrice =sellCostBuyPrice-190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-190, sellCostMeanBuyPrice = sellCostMeanBuyPrice-190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-190
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 23:40:55' WHERE storedetailid = '362';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('362', '1', '2', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '21', '1', '2026-09-20 23:14:29','0','0'); -- id=1280
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 = 556;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (358, '2026-09-20', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-545, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-20', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-545, sellCostBuyPrice =sellCostBuyPrice-525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-525, sellCostMeanBuyPrice = sellCostMeanBuyPrice-525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-525
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2026-09-20 23:40:55' WHERE storedetailid = '358';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('358', '1', '5', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '21', '26', '1', '2026-09-20 23:14:29','0','0'); -- id=1281
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 = 557;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (359, '2026-09-20', 848, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-848, sellCostBuyPrice =sellCostBuyPrice-840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-840, sellCostMeanBuyPrice = sellCostMeanBuyPrice-840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-840
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-20', 848, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-848, sellCostBuyPrice =sellCostBuyPrice-840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-840, sellCostMeanBuyPrice = sellCostMeanBuyPrice-840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-840
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-09-20 23:40:55' WHERE storedetailid = '359';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('359', '1', '8', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '17', '25', '1', '2026-09-20 23:14:29','0','0'); -- id=1282
UPDATE sellbilldetail SET  lastbuyprice = 84.46 , meanbuyprice = 84.46, lastbuyprice_withDiscount = 84.46, meanbuyprice_withDiscount = 84.46
        , lastbuyprice_withTax = 84.46, meanbuyprice_withTax = 84.46, lastbuyprice_withDiscountAndTax = 84.46
                where sellbilldetailid = 558;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (365, '2026-09-20', 174, 168.92, 168.92
                    , 168.92, 168.92, 168.92, 168.92
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 168.92, 168.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-174, sellCostBuyPrice =sellCostBuyPrice-168.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-168.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-168.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-168.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-168.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-168.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-168.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-168.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-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-20', 174, 168.92, 168.92
                    , 168.92, 168.92, 168.92, 168.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 168.92, 168.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-174, sellCostBuyPrice =sellCostBuyPrice-168.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-168.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice-168.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-168.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-168.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-168.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-168.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-168.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 = '38', userid = '1', storedetaildate = '2026-09-20 23:40:55' WHERE storedetailid = '365';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('365', '1', '2', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '36', '38', '1', '2026-09-20 23:14:29','0','0'); -- id=1283
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 = 559;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (367, '2026-09-20', 132, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-132, sellCostBuyPrice =sellCostBuyPrice-126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-126, sellCostMeanBuyPrice = sellCostMeanBuyPrice-126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-126
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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-20', 132, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-132, sellCostBuyPrice =sellCostBuyPrice-126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-126, sellCostMeanBuyPrice = sellCostMeanBuyPrice-126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-126
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-09-20 23:40:55' WHERE storedetailid = '367';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('367', '1', '2', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '32', '1', '2026-09-20 23:14:29','0','0'); -- id=1284
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 = 560;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (363, '2026-09-20', 170, 163, 163
                    , 163, 163, 163, 163
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 163, 163, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-163
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-163, sellCostMeanBuyPrice = sellCostMeanBuyPrice-163
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-163, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-163
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-163
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-163
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-163
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-20', 170, 163, 163
                    , 163, 163, 163, 163
                    , 0, 0, 0, 0
                    , 0, 0, 0, 163, 163, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-170, sellCostBuyPrice =sellCostBuyPrice-163
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-163, sellCostMeanBuyPrice = sellCostMeanBuyPrice-163
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-163, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-163
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-163
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-163
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-163
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-20 23:40:55' WHERE storedetailid = '363';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('363', '1', '1', '0', '80', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '31', '1', '2026-09-20 23:14:29','0','0'); -- id=1285
CALL clientInUse(22,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '22';
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 ('22','14444.80','14444.80','1','تعديل فاتورة مبيعات','80', '0', '2026-09-20 23:14:29', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '14444.8', '0', null, '0', null, null,'', '0','1','1','14444.8','1','2026-09-20 23:14:29','0','0','',''); -- id=130
UPDATE client SET  inUse = 0 where clientid = 22;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-20', 14444.8, 13957.82, 13957.82
                    , 13957.82, 13957.82, 13957.82, 13957.82
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13957.82, 13957.82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-14444.8, sellCostBuyPrice =sellCostBuyPrice-13957.82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13957.82, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13957.82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13957.82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13957.82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13957.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13957.82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13957.82
                        , returnSellVal = returnSellVal-0, 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 (22, '2026-09-20', 14444.8, 13957.82, 13957.82
                    , 13957.82, 13957.82, 13957.82, 13957.82
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13957.82, 13957.82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-14444.8, sellCostBuyPrice =sellCostBuyPrice-13957.82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-13957.82, sellCostMeanBuyPrice = sellCostMeanBuyPrice-13957.82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-13957.82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-13957.82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-13957.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-13957.82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-13957.82
                        , returnSellVal = returnSellVal-0, 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, 14444.8, 13957.82, 13957.82
                    , 13957.82, 13957.82, 13957.82, 13957.82, 13957.82, 13957.82)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-14444.8, netSellCostBuyPrice = netSellCostBuyPrice-13957.82
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-13957.82
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-13957.82
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-13957.82
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-13957.82
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-13957.82
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-13957.82
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-13957.82;

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


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

COMMIT;
BEGIN;
CALL clientInUse(22,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-20 23:14:29', '06ab047d34dd99', '22', '0.00', '14534.8', '0', '1', '14534.8', '14534.8', '0', '14534.8', '1', '2026-09-20 23:14:29', '', '1', '0', 'اسامه صلاح ', '1', '1', '3', '0', 'اسامه صلاح ', '392', '80', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-20','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=81
UPDATE client SET  clientdebt = '14534.8', userid = '1' WHERE clientid = '22';
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 ('22','0.00','14534.8','0','اضافة فاتورة مبيعات (معدله)','81', '14534.8', '2026-09-20 23:40:56', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '14534.8', '0', null, '0', null, null,'', '0','1','1','14444.8','1','2026-09-20 23:14:29','0','0','',''); -- id=131
UPDATE client SET  inUse = 0 where clientid = 22;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.79','00355', '81', '1', '355', '110.00', '54.78', '6025.8', '0', '', '1', '2026-09-20 23:40:56', '355', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54.78','6025.8','0','','0','0.00','0','0','0','0'); -- id=561
UPDATE sellbilldetail SET  lastbuyprice = 52.79 , meanbuyprice = 52.79, lastbuyprice_withDiscount = 52.79, meanbuyprice_withDiscount = 52.79
        , lastbuyprice_withTax = 52.79, meanbuyprice_withTax = 52.79, lastbuyprice_withDiscountAndTax = 52.79
                where sellbilldetailid = 561;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (355, '2026-09-20', 6025.8, 5806.9, 5806.9
                    , 5806.9, 5806.9, 5806.9, 5806.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 110, 0, 5806.9, 5806.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6025.8, sellCostBuyPrice =sellCostBuyPrice+5806.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5806.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5806.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5806.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5806.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5806.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5806.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5806.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+110
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 6025.8, 5806.9, 5806.9
                    , 5806.9, 5806.9, 5806.9, 5806.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5806.9, 5806.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6025.8, sellCostBuyPrice =sellCostBuyPrice+5806.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5806.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5806.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5806.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5806.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5806.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5806.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5806.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 = '72', userid = '1', storedetaildate = '2026-09-20 23:40:57' WHERE storedetailid = '355';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('355', '1', '110', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '182', '72', '1', '2026-09-20 23:40:57','0','0'); -- id=1286
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00360', '81', '1', '360', '120.00', '10.95', '1314', '0', '', '1', '2026-09-20 23:40:57', '360', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','10.95','1314','0','','0','0.00','0','0','0','0'); -- id=562
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 = 562;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (360, '2026-09-20', 1314, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 120, 0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1314, sellCostBuyPrice =sellCostBuyPrice+1266
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1266, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1266
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1266
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1266
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1266
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+120
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 1314, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1314, sellCostBuyPrice =sellCostBuyPrice+1266
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1266, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1266
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1266
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1266
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1266
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:40:57' WHERE storedetailid = '360';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('360', '1', '120', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '289', '169', '1', '2026-09-20 23:40:57','0','0'); -- id=1287
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00356', '81', '1', '356', '75.00', '36', '2700', '0', '', '1', '2026-09-20 23:40:57', '356', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','2700','0','','0','0.00','0','0','0','0'); -- id=563
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 = 563;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (356, '2026-09-20', 2700, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+75
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2700, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:40:57' WHERE storedetailid = '356';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('356', '1', '75', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '244', '169', '1', '2026-09-20 23:40:57','0','0'); -- id=1288
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00357', '81', '1', '357', '65.00', '36', '2340', '0', '', '1', '2026-09-20 23:40:57', '357', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','36','2340','0','','0','0.00','0','0','0','0'); -- id=564
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 = 564;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (357, '2026-09-20', 2340, 2262, 2262
                    , 2262, 2262, 2262, 2262
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 0, 2262, 2262, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2262
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2262, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2262
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2262, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2262
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2262
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2262
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2262
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+65
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-20', 2340, 2262, 2262
                    , 2262, 2262, 2262, 2262
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2262, 2262, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2262
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2262, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2262
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2262, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2262
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2262
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2262
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2262
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '186', userid = '1', storedetaildate = '2026-09-20 23:40:58' WHERE storedetailid = '357';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('357', '1', '65', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '251', '186', '1', '2026-09-20 23:40:58','0','0'); -- id=1289
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('95','00362', '81', '1', '362', '2.00', '98', '196', '0', '', '1', '2026-09-20 23:40:58', '362', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','98','196','0','','0','0.00','0','0','0','0'); -- id=565
UPDATE sellbilldetail SET  lastbuyprice = 95.00 , meanbuyprice = 95.00, lastbuyprice_withDiscount = 95.00, meanbuyprice_withDiscount = 95.00
        , lastbuyprice_withTax = 95, meanbuyprice_withTax = 95, lastbuyprice_withDiscountAndTax = 95
                where sellbilldetailid = 565;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (362, '2026-09-20', 196, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+196, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 196, 190, 190
                    , 190, 190, 190, 190
                    , 0, 0, 0, 0
                    , 0, 0, 0, 190, 190, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+196, sellCostBuyPrice =sellCostBuyPrice+190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+190, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+190
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+190
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+190
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:40:58' WHERE storedetailid = '362';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('362', '1', '2', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '21', '19', '1', '2026-09-20 23:40:58','0','0'); -- id=1290
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00358', '81', '1', '358', '5.00', '109', '545', '0', '', '1', '2026-09-20 23:40:58', '358', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','109','545','0','','0','0.00','0','0','0','0'); -- id=566
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 = 566;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (358, '2026-09-20', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 545, 525, 525
                    , 525, 525, 525, 525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 525, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+545, sellCostBuyPrice =sellCostBuyPrice+525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-09-20 23:40:58' WHERE storedetailid = '358';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('358', '1', '5', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '26', '21', '1', '2026-09-20 23:40:58','0','0'); -- id=1291
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00359', '81', '1', '359', '8.00', '106', '848', '0', '', '1', '2026-09-20 23:40:58', '359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','106','848','0','','0','0.00','0','0','0','0'); -- id=567
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 = 567;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (359, '2026-09-20', 848, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+848, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 848, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+848, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2026-09-20 23:40:59' WHERE storedetailid = '359';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('359', '1', '8', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '25', '17', '1', '2026-09-20 23:40:59','0','0'); -- id=1292
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.46','00365', '81', '1', '365', '2.00', '87', '174', '0', '', '1', '2026-09-20 23:40:59', '365', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','87','174','0','','0','0.00','0','0','0','0'); -- id=568
UPDATE sellbilldetail SET  lastbuyprice = 84.46 , meanbuyprice = 84.46, lastbuyprice_withDiscount = 84.46, meanbuyprice_withDiscount = 84.46
        , lastbuyprice_withTax = 84.46, meanbuyprice_withTax = 84.46, lastbuyprice_withDiscountAndTax = 84.46
                where sellbilldetailid = 568;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (365, '2026-09-20', 174, 168.92, 168.92
                    , 168.92, 168.92, 168.92, 168.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 168.92, 168.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+174, sellCostBuyPrice =sellCostBuyPrice+168.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+168.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+168.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+168.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+168.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+168.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+168.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+168.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+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-20', 174, 168.92, 168.92
                    , 168.92, 168.92, 168.92, 168.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 168.92, 168.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+174, sellCostBuyPrice =sellCostBuyPrice+168.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+168.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+168.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+168.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+168.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+168.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+168.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+168.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 = '36', userid = '1', storedetaildate = '2026-09-20 23:40:59' WHERE storedetailid = '365';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('365', '1', '2', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '38', '36', '1', '2026-09-20 23:40:59','0','0'); -- id=1293
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00367', '81', '1', '367', '2.00', '66', '132', '0', '', '1', '2026-09-20 23:40:59', '367', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','66','132','0','','0','0.00','0','0','0','0'); -- id=569
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 = 569;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (367, '2026-09-20', 132, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+132, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 132, 126, 126
                    , 126, 126, 126, 126
                    , 0, 0, 0, 0
                    , 0, 0, 0, 126, 126, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+132, sellCostBuyPrice =sellCostBuyPrice+126
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+126, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+126, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+126
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+126
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-09-20 23:40:59' WHERE storedetailid = '367';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('367', '1', '2', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '30', '1', '2026-09-20 23:40:59','0','0'); -- id=1294
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00363', '81', '1', '363', '1.00', '170', '170', '0', '', '1', '2026-09-20 23:40:59', '363', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','170','170','0','','0','0.00','0','0','0','0'); -- id=570
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 = 570;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (363, '2026-09-20', 170, 163, 163
                    , 163, 163, 163, 163
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 163, 163, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+163
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+163, sellCostMeanBuyPrice = sellCostMeanBuyPrice+163
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+163, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+163
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+163
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+163
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+163
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-20', 170, 163, 163
                    , 163, 163, 163, 163
                    , 0, 0, 0, 0
                    , 0, 0, 0, 163, 163, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+163
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+163, sellCostMeanBuyPrice = sellCostMeanBuyPrice+163
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+163, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+163
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+163
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+163
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+163
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-20 23:41:00' WHERE storedetailid = '363';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('363', '1', '1', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '31', '30', '1', '2026-09-20 23:41:00','0','0'); -- id=1295
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00431', '81', '8', '431', '2', '45', '90', '0', '', '1', '2026-09-20 23:41:00', '431', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45','90','0','','0','0.00','0','0','0','0'); -- id=571
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 = 571;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (431, '2026-09-20', 90, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+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-20', 90, 80, 80
                    , 80, 80, 80, 80
                    , 0, 0, 0, 0
                    , 0, 0, 0, 80, 80, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+90, sellCostBuyPrice =sellCostBuyPrice+80
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+80, sellCostMeanBuyPrice = sellCostMeanBuyPrice+80
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+80, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+80
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+80
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+80
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+80
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-09-20 23:41:00' WHERE storedetailid = '431';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('431', '1', '2', '1', '81', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '3', '1', '2026-09-20 23:41:00','0','0'); -- id=1296
UPDATE dailyentry SET totalcreditor = '14444.80', totaldebtor = '14444.80', thedate = '2026-09-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-20 23:14:34', entryComment = 'اضافة فاتورة مبيعات رقم 80', fromFlag = '1',related='0',isopeningentry='0',operationId='80',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=80' WHERE id = '700';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14444.80', '14444.80', '2026-09-20', '1', '0', '700', '2026-09-20 23:41:00','تم عكس القيد رقم 700 ','1','0','0','0','0',''); -- id=703
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('703', '451', '14444.80', '','0'); -- id=703
UPDATE accountstree SET name = 'اسامه صلاح ', customName = 'اسامه صلاح ', customNameEn = 'اسامه صلاح ', nameEn = 'اسامه صلاح ', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 22:53:58' WHERE id = '451';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('703', '143', '14444.80', '','0'); -- id=703
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '250378.95', 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 = '13957.82', totaldebtor = '13957.82', thedate = '2026-09-20', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-20 23:14:34', entryComment = 'اضافة فاتورة مبيعات رقم 80 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='80',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=80' WHERE id = '701';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13957.82', '13957.82', '2026-09-20', '1', '0', '701', '2026-09-20 23:41:01','تم عكس القيد رقم 701 ','1','0','0','0','0',''); -- id=704
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('704', '402', '13957.82', '','0'); -- id=704
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '234257.02', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('704', '382', '13957.82', '','0'); -- id=704
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2131077.05', 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 ( '14534.8', '14534.8', '2026-09-20', '1', '0', '0', '2026-09-20 23:41:01','اضافة فاتورة مبيعات رقم 81','1','0',null,'0','81','sellbillController.php?do=showDetail&sellbillid=81'); -- id=705
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('705', '451', '14534.8', '','0'); -- id=705
UPDATE accountstree SET name = 'اسامه صلاح ', customName = 'اسامه صلاح ', customNameEn = 'اسامه صلاح ', nameEn = 'اسامه صلاح ', parent = '58', accountNature = '0', theValue = '14534.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-20 22:53:58' WHERE id = '451';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('705', '143', '14534.8', '','0'); -- id=705
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '264913.75', 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 ( '14037.82', '14037.82', '2026-09-20', '1', '0', '0', '2026-09-20 23:41:01','اضافة فاتورة مبيعات رقم 81 - صرف البضاعة من المخزن','1','0',null,'0','81','sellbillController.php?do=showDetail&sellbillid=81'); -- id=706
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('706', '402', '14037.82', '','0'); -- id=706
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '248294.84', 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 ('706', '382', '14037.82', '','0'); -- id=706
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2117039.23', 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='705,0,706' where sellbillid=81;
 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-20', 14534.8, 14037.82, 14037.82
                    , 14037.82, 14037.82, 14037.82, 14037.82
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14037.82, 14037.82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14534.8, sellCostBuyPrice =sellCostBuyPrice+14037.82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14037.82, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14037.82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14037.82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14037.82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14037.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14037.82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14037.82
                        , returnSellVal = returnSellVal+0, 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 (22, '2026-09-20', 14534.8, 14037.82, 14037.82
                    , 14037.82, 14037.82, 14037.82, 14037.82
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14037.82, 14037.82, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14534.8, sellCostBuyPrice =sellCostBuyPrice+14037.82
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14037.82, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14037.82
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14037.82, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14037.82
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14037.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14037.82
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14037.82
                        , returnSellVal = returnSellVal+0, 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, 14534.8, 14037.82, 14037.82
                    , 14037.82, 14037.82, 14037.82, 14037.82, 14037.82, 14037.82)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14534.8, netSellCostBuyPrice = netSellCostBuyPrice+14037.82
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14037.82
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14037.82
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14037.82
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14037.82
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14037.82
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14037.82
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14037.82;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 80 and newid=81 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-20 20:11:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-20 23:41:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-20 23:41:03', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=81'); -- id=1841
