UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 05:36:17";
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-27 05:36:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:06:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-27 09:06:25', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=2523
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-27',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-27 05:36:31";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-27 09:06:31', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=2524
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 05:36:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:06:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:06:37', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2525
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:09:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:39:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:39:54', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2526
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:10:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:40:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:40:07', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2527
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:10:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:40:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:40:12', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=137'); -- id=2528
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:14:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:44:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:44:54', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2529
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 137;
UPDATE sellbill SET  sellbillsysdate = '2026-09-27 09:44:55', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '137';
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 = 947;
 INSERT INTO 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-27', 4095, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 3989.7
                    , 0, 0, 0, 0
                    , 0, 0, 0,90,0, 3989.7, 3989.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4095, sellCostBuyPrice =sellCostBuyPrice-3989.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3989.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3989.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3989.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3989.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3989.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3989.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3989.7
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-90
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 4095, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 3989.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3989.7, 3989.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4095, sellCostBuyPrice =sellCostBuyPrice-3989.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3989.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3989.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3989.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3989.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3989.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3989.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3989.7
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '475', userid = '1', storedetaildate = '2026-09-27 09:44:55' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '90', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '385', '475', '1', '2026-09-26 19:55:18','0','0'); -- id=1965
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 = 948;
 INSERT INTO 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-27', 2731.5, 2655, 2655
                    , 2655, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0,90,0, 2655, 2655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2731.5, sellCostBuyPrice =sellCostBuyPrice-2655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2655, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2655
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-90
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 2731.5, 2655, 2655
                    , 2655, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2655, 2655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2731.5, sellCostBuyPrice =sellCostBuyPrice-2655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2655, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2655
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-27 09:44:55' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '90', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '704', '794', '1', '2026-09-26 19:55:18','0','0'); -- id=1966
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 = 949;
 INSERT INTO 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-27', 2276.25, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 2212.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,75,0, 2212.5, 2212.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2276.25, sellCostBuyPrice =sellCostBuyPrice-2212.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2212.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2212.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2212.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2212.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2212.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2212.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2212.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-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-27', 2276.25, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 2212.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2212.5, 2212.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2276.25, sellCostBuyPrice =sellCostBuyPrice-2212.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2212.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2212.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2212.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2212.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2212.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2212.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2212.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 = '696', userid = '1', storedetaildate = '2026-09-27 09:44:55' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '75', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '621', '696', '1', '2026-09-26 19:55:18','0','0'); -- id=1967
UPDATE sellbilldetail SET  lastbuyprice = 191.00 , meanbuyprice = 191.00, lastbuyprice_withDiscount = 191.00, meanbuyprice_withDiscount = 191.00
        , lastbuyprice_withTax = 191, meanbuyprice_withTax = 191, lastbuyprice_withDiscountAndTax = 191
                where sellbilldetailid = 950;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (376, '2026-09-27', 1640, 1528, 1528
                    , 1528, 1528, 1528, 1528
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 1528, 1528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1640, sellCostBuyPrice =sellCostBuyPrice-1528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1528, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1528
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 1640, 1528, 1528
                    , 1528, 1528, 1528, 1528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1528, 1528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1640, sellCostBuyPrice =sellCostBuyPrice-1528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1528, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1528
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-27 09:44:55' WHERE storedetailid = '376';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('376', '1', '8', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '8', '1', '2026-09-26 19:55:18','0','0'); -- id=1968
UPDATE sellbilldetail SET  lastbuyprice = 137.25 , meanbuyprice = 137.25, lastbuyprice_withDiscount = 137.25, meanbuyprice_withDiscount = 137.25
        , lastbuyprice_withTax = 137.25, meanbuyprice_withTax = 137.25, lastbuyprice_withDiscountAndTax = 137.25
                where sellbilldetailid = 951;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (50, '2026-09-27', 705, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 686.25
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 686.25, 686.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-705, sellCostBuyPrice =sellCostBuyPrice-686.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-686.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-686.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-686.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-686.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-686.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-686.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-686.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-27', 705, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 686.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 686.25, 686.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-705, sellCostBuyPrice =sellCostBuyPrice-686.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-686.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-686.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-686.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-686.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-686.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-686.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-686.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 = '66', userid = '1', storedetaildate = '2026-09-27 09:44:55' WHERE storedetailid = '50';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('50', '1', '5', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '61', '66', '1', '2026-09-26 19:55:18','0','0'); -- id=1969
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 = 952;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-09-27', 163.5, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-163.5, sellCostBuyPrice =sellCostBuyPrice-158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice-158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-158.37
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 163.5, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-163.5, sellCostBuyPrice =sellCostBuyPrice-158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice-158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-158.37
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '120', userid = '1', storedetaildate = '2026-09-27 09:44:55' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '3', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '117', '120', '1', '2026-09-26 19:55:18','0','0'); -- id=1970
UPDATE sellbilldetail SET  lastbuyprice = 254.00 , meanbuyprice = 254.00, lastbuyprice_withDiscount = 254.00, meanbuyprice_withDiscount = 254.00
        , lastbuyprice_withTax = 254, meanbuyprice_withTax = 254, lastbuyprice_withDiscountAndTax = 254
                where sellbilldetailid = 953;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (314, '2026-09-27', 783, 762, 762
                    , 762, 762, 762, 762
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 762, 762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-783, sellCostBuyPrice =sellCostBuyPrice-762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 783, 762, 762
                    , 762, 762, 762, 762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 762, 762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-783, sellCostBuyPrice =sellCostBuyPrice-762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-762, sellCostMeanBuyPrice = sellCostMeanBuyPrice-762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-762
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-27 09:44:55' WHERE storedetailid = '314';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('314', '1', '3', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '6', '1', '2026-09-26 19:55:18','0','0'); -- id=1971
UPDATE sellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where sellbilldetailid = 954;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-09-27', 318, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-318, sellCostBuyPrice =sellCostBuyPrice-304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice-304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-304.02
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 318, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-318, sellCostBuyPrice =sellCostBuyPrice-304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice-304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-304.02
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '77', userid = '1', storedetaildate = '2026-09-27 09:44:55' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '6', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '71', '77', '1', '2026-09-26 19:55:18','0','0'); -- id=1972
UPDATE sellbilldetail SET  lastbuyprice = 100.30 , meanbuyprice = 100.30, lastbuyprice_withDiscount = 100.30, meanbuyprice_withDiscount = 100.30
        , lastbuyprice_withTax = 100.3, meanbuyprice_withTax = 100.3, lastbuyprice_withDiscountAndTax = 100.3
                where sellbilldetailid = 955;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (49, '2026-09-27', 208, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-208, sellCostBuyPrice =sellCostBuyPrice-200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-200.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 208, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-208, sellCostBuyPrice =sellCostBuyPrice-200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-200.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-27 09:44:55' WHERE storedetailid = '49';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('49', '1', '2', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '-2', '0', '1', '2026-09-26 19:55:18','0','0'); -- id=1973
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 = 956;
 INSERT INTO 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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-925, sellCostBuyPrice =sellCostBuyPrice-897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-897, sellCostMeanBuyPrice = sellCostMeanBuyPrice-897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-897
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-925, sellCostBuyPrice =sellCostBuyPrice-897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-897, sellCostMeanBuyPrice = sellCostMeanBuyPrice-897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-897
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-27 09:44:56' WHERE storedetailid = '46';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '1', '10', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '85', '95', '1', '2026-09-26 19:55:18','0','0'); -- id=1974
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 = 957;
 INSERT INTO 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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-925, sellCostBuyPrice =sellCostBuyPrice-897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-897, sellCostMeanBuyPrice = sellCostMeanBuyPrice-897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-897
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-925, sellCostBuyPrice =sellCostBuyPrice-897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-897, sellCostMeanBuyPrice = sellCostMeanBuyPrice-897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-897
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-27 09:44:56' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '10', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '94', '104', '1', '2026-09-26 19:55:18','0','0'); -- id=1975
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 = 958;
 INSERT INTO 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-27', 190, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.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-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-27', 190, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice-184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-184.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 = '86', userid = '1', storedetaildate = '2026-09-27 09:44:56' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '5', '0', '137', 'تعديل فاتورة مبيعات', 'sellbillController.php', '81', '86', '1', '2026-09-26 19:55:18','0','0'); -- id=1976
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.00','1','تعديل فاتورة مبيعات','137', '0', '2026-09-26 19:55:18', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '14960.25', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 19:55:18','0','0','',''); -- id=234
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-339617',  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 ('-324656.75','14960.25', '1', '1', 'تعديل فاتورة مبيعات', '137', '-339617', '2026-09-27 09:44:56', '1',  'sellbillController.php','1','','0'); -- id=146
 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-27', 14960.25, 14475.19, 14475.19
                    , 14475.19, 14475.19, 14475.19, 14475.19
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14475.19, 14475.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-14960.25, sellCostBuyPrice =sellCostBuyPrice-14475.19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-14475.19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-14475.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-14475.19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-14475.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-14475.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-14475.19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-14475.19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 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-27', 14960.25, 14475.19, 14475.19
                    , 14475.19, 14475.19, 14475.19, 14475.19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14475.19, 14475.19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-14960.25, sellCostBuyPrice =sellCostBuyPrice-14475.19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-14475.19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-14475.19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-14475.19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-14475.19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-14475.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-14475.19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-14475.19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 14960.25, 14475.19, 14475.19
                    , 14475.19, 14475.19, 14475.19, 14475.19, 14475.19, 14475.19)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-14960.25, netSellCostBuyPrice = netSellCostBuyPrice-14475.19
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-14475.19
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-14475.19
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-14475.19
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-14475.19
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-14475.19
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-14475.19
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-14475.19;

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


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

COMMIT;
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,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 19:55:18', '06ab804f078398', '1', '0.00', '0', '0', '1', '17845.12', '17845.12', '17845.12', '0', '1', '2026-09-26 19:55:18', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '464', '137', 'sellbillController', '0','','','','','-1','0','0','17845.12','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=139
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','اضافة فاتورة مبيعات (معدله)','139', '0', '2026-09-27 09:44:57', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '17845.12', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-26 19:55:18','0','0','',''); -- id=235
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('44.33','00041', '139', '1', '41', '90.00', '45.43', '4088.7', '0', '', '1', '2026-09-27 09:44:57', '41', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','45.43','4088.7','0','','0','0.00','0','0','0','0'); -- id=961
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 = 961;
 INSERT INTO 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-27', 4088.7, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 3989.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 0, 3989.7, 3989.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4088.7, sellCostBuyPrice =sellCostBuyPrice+3989.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3989.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3989.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3989.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3989.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3989.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3989.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3989.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+90
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 4088.7, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 3989.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3989.7, 3989.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4088.7, sellCostBuyPrice =sellCostBuyPrice+3989.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3989.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3989.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3989.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3989.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3989.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3989.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3989.7
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '385', userid = '1', storedetaildate = '2026-09-27 09:44:57' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '90', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '475', '385', '1', '2026-09-27 09:44:57','0','0'); -- id=1977
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '139', '1', '42', '90.00', '30.29', '2726.1', '0', '', '1', '2026-09-27 09:44:57', '42', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30.29','2726.1','0','','0','0.00','0','0','0','0'); -- id=962
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 = 962;
 INSERT INTO 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-27', 2726.1, 2655, 2655
                    , 2655, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 0, 2655, 2655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2726.1, sellCostBuyPrice =sellCostBuyPrice+2655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2655
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+90
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 2726.1, 2655, 2655
                    , 2655, 2655, 2655, 2655
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2655, 2655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2726.1, sellCostBuyPrice =sellCostBuyPrice+2655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2655, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2655
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2655
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2655
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '704', userid = '1', storedetaildate = '2026-09-27 09:44:58' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '90', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '794', '704', '1', '2026-09-27 09:44:58','0','0'); -- id=1978
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '139', '1', '43', '75.00', '30.29', '2271.75', '0', '', '1', '2026-09-27 09:44:58', '43', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','30.29','2271.75','0','','0','0.00','0','0','0','0'); -- id=963
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 = 963;
 INSERT INTO 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-27', 2271.75, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 2212.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 2212.5, 2212.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2271.75, sellCostBuyPrice =sellCostBuyPrice+2212.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2212.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2212.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2212.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2212.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2212.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2212.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2212.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+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-27', 2271.75, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 2212.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2212.5, 2212.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2271.75, sellCostBuyPrice =sellCostBuyPrice+2212.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2212.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2212.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2212.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2212.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2212.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2212.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2212.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 = '621', userid = '1', storedetaildate = '2026-09-27 09:44:58' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '75', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '696', '621', '1', '2026-09-27 09:44:58','0','0'); -- id=1979
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('191','00376', '139', '1', '376', '8.00', '194', '1552', '0', '', '1', '2026-09-27 09:44:58', '376', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','194','1552','0','','0','0.00','0','0','0','0'); -- id=964
UPDATE sellbilldetail SET  lastbuyprice = 191.00 , meanbuyprice = 191.00, lastbuyprice_withDiscount = 191.00, meanbuyprice_withDiscount = 191.00
        , lastbuyprice_withTax = 191, meanbuyprice_withTax = 191, lastbuyprice_withDiscountAndTax = 191
                where sellbilldetailid = 964;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (376, '2026-09-27', 1552, 1528, 1528
                    , 1528, 1528, 1528, 1528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1528, 1528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1552, sellCostBuyPrice =sellCostBuyPrice+1528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 1552, 1528, 1528
                    , 1528, 1528, 1528, 1528
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1528, 1528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1552, sellCostBuyPrice =sellCostBuyPrice+1528
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1528, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1528
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1528, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1528
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1528
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1528
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 09:44:58' WHERE storedetailid = '376';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('376', '1', '8', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '0', '1', '2026-09-27 09:44:58','0','0'); -- id=1980
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('137.25','00050', '139', '1', '50', '5.00', '141', '705', '0', '', '1', '2026-09-27 09:44:58', '50', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','141','705','0','','0','0.00','0','0','0','0'); -- id=965
UPDATE sellbilldetail SET  lastbuyprice = 137.25 , meanbuyprice = 137.25, lastbuyprice_withDiscount = 137.25, meanbuyprice_withDiscount = 137.25
        , lastbuyprice_withTax = 137.25, meanbuyprice_withTax = 137.25, lastbuyprice_withDiscountAndTax = 137.25
                where sellbilldetailid = 965;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (50, '2026-09-27', 705, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 686.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 686.25, 686.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+686.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+686.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+686.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+686.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+686.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+686.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+686.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+686.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-27', 705, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 686.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 686.25, 686.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+705, sellCostBuyPrice =sellCostBuyPrice+686.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+686.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+686.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+686.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+686.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+686.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+686.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+686.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 = '61', userid = '1', storedetaildate = '2026-09-27 09:44:59' WHERE storedetailid = '50';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('50', '1', '5', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '66', '61', '1', '2026-09-27 09:44:59','0','0'); -- id=1981
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00048', '139', '1', '48', '3.00', '54.10', '162.3', '0', '', '1', '2026-09-27 09:44:59', '48', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','54.1','162.3','0','','0','0.00','0','0','0','0'); -- id=966
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 = 966;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-09-27', 162.3, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+162.3, sellCostBuyPrice =sellCostBuyPrice+158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.37
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 162.3, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 158.37
                    , 0, 0, 0, 0
                    , 0, 0, 0, 158.37, 158.37, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+162.3, sellCostBuyPrice =sellCostBuyPrice+158.37
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+158.37, sellCostMeanBuyPrice = sellCostMeanBuyPrice+158.37
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+158.37, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+158.37
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+158.37
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+158.37
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+158.37
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '117', userid = '1', storedetaildate = '2026-09-27 09:44:59' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '3', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '120', '117', '1', '2026-09-27 09:44:59','0','0'); -- id=1982
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('254','00314', '139', '1', '314', '3.00', '259.7', '779.0999999999999', '0', '', '1', '2026-09-27 09:44:59', '314', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','259.7','779.1','0','','0','0.00','0','0','0','0'); -- id=967
UPDATE sellbilldetail SET  lastbuyprice = 254.00 , meanbuyprice = 254.00, lastbuyprice_withDiscount = 254.00, meanbuyprice_withDiscount = 254.00
        , lastbuyprice_withTax = 254, meanbuyprice_withTax = 254, lastbuyprice_withDiscountAndTax = 254
                where sellbilldetailid = 967;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (314, '2026-09-27', 779.1, 762, 762
                    , 762, 762, 762, 762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 762, 762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+779.1, sellCostBuyPrice =sellCostBuyPrice+762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 779.1, 762, 762
                    , 762, 762, 762, 762
                    , 0, 0, 0, 0
                    , 0, 0, 0, 762, 762, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+779.1, sellCostBuyPrice =sellCostBuyPrice+762
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+762, sellCostMeanBuyPrice = sellCostMeanBuyPrice+762
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+762, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+762
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+762
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+762
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+762
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 09:44:59' WHERE storedetailid = '314';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('314', '1', '3', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '6', '3', '1', '2026-09-27 09:44:59','0','0'); -- id=1983
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('50.67','00053', '139', '1', '53', '6.00', '52', '312', '0', '', '1', '2026-09-27 09:44:59', '53', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','52','312','0','','0','0.00','0','0','0','0'); -- id=968
UPDATE sellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where sellbilldetailid = 968;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-09-27', 312, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 312, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 304.02
                    , 0, 0, 0, 0
                    , 0, 0, 0, 304.02, 304.02, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312, sellCostBuyPrice =sellCostBuyPrice+304.02
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+304.02, sellCostMeanBuyPrice = sellCostMeanBuyPrice+304.02
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+304.02, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+304.02
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+304.02
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+304.02
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+304.02
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '71', userid = '1', storedetaildate = '2026-09-27 09:45:00' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '6', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '77', '71', '1', '2026-09-27 09:45:00','0','0'); -- id=1984
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('100.3','00049', '139', '1', '49', '2.00', '102.8', '205.6', '0', '', '1', '2026-09-27 09:45:00', '49', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','102.8','205.6','0','','0','0.00','0','0','0','0'); -- id=969
UPDATE sellbilldetail SET  lastbuyprice = 100.30 , meanbuyprice = 100.30, lastbuyprice_withDiscount = 100.30, meanbuyprice_withDiscount = 100.30
        , lastbuyprice_withTax = 100.3, meanbuyprice_withTax = 100.3, lastbuyprice_withDiscountAndTax = 100.3
                where sellbilldetailid = 969;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (49, '2026-09-27', 205.6, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+205.6, sellCostBuyPrice =sellCostBuyPrice+200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 205.6, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 200.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 200.6, 200.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+205.6, sellCostBuyPrice =sellCostBuyPrice+200.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+200.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+200.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+200.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+200.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+200.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+200.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+200.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-2', userid = '1', storedetaildate = '2026-09-27 09:45:00' WHERE storedetailid = '49';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('49', '1', '2', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '0', '-2', '1', '2026-09-27 09:45:00','0','0'); -- id=1985
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '139', '1', '46', '10.00', '92.5', '925', '0', '', '1', '2026-09-27 09:45:00', '46', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','92.5','925','0','','0','0.00','0','0','0','0'); -- id=970
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 = 970;
 INSERT INTO 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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 09:45:00' WHERE storedetailid = '46';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '1', '10', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '95', '85', '1', '2026-09-27 09:45:00','0','0'); -- id=1986
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '139', '1', '47', '10.00', '92.5', '925', '0', '', '1', '2026-09-27 09:45:00', '47', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','92.5','925','0','','0','0.00','0','0','0','0'); -- id=971
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 = 971;
 INSERT INTO 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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 925, 897, 897
                    , 897, 897, 897, 897
                    , 0, 0, 0, 0
                    , 0, 0, 0, 897, 897, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+925, sellCostBuyPrice =sellCostBuyPrice+897
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+897, sellCostMeanBuyPrice = sellCostMeanBuyPrice+897
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+897, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+897
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+897
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+897
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+897
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '94', userid = '1', storedetaildate = '2026-09-27 09:45:01' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '10', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '104', '94', '1', '2026-09-27 09:45:01','0','0'); -- id=1987
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '139', '1', '51', '5.00', '37.87', '189.35', '0', '', '1', '2026-09-27 09:45:01', '51', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','37.87','189.35','0','','0','0.00','0','0','0','0'); -- id=972
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 = 972;
 INSERT INTO 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-27', 189.35, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.35, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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+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-27', 189.35, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 184.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 184.75, 184.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.35, sellCostBuyPrice =sellCostBuyPrice+184.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+184.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+184.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+184.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+184.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+184.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+184.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+184.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 = '81', userid = '1', storedetaildate = '2026-09-27 09:45:01' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '5', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '86', '81', '1', '2026-09-27 09:45:01','0','0'); -- id=1988
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '139', '1', '44', '150', '8.66', '1299', '0', '', '1', '2026-09-27 09:45:01', '44', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8.66','1299','0','','0','0.00','0','0','0','0'); -- id=973
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 = 973;
 INSERT INTO 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-27', 1299, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 150, 0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1299, 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+150
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 1299, 1266, 1266
                    , 1266, 1266, 1266, 1266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1266, 1266, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1299, 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 = '880', userid = '1', storedetaildate = '2026-09-27 09:45:01' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '150', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1030', '880', '1', '2026-09-27 09:45:01','0','0'); -- id=1989
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '139', '1', '45', '7', '243.46', '1704.22', '0', '', '1', '2026-09-27 09:45:01', '45', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','243.46','1704.22','0','','0','0.00','0','0','0','0'); -- id=974
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 = 974;
 INSERT INTO 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-27', 1704.22, 1662.5, 1662.5
                    , 1662.5, 1662.5, 1662.5, 1662.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 1662.5, 1662.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1704.22, sellCostBuyPrice =sellCostBuyPrice+1662.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1662.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1662.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1662.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1662.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1662.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1662.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1662.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-27', 1704.22, 1662.5, 1662.5
                    , 1662.5, 1662.5, 1662.5, 1662.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1662.5, 1662.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1704.22, sellCostBuyPrice =sellCostBuyPrice+1662.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1662.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1662.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1662.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1662.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1662.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1662.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1662.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 = '61', userid = '1', storedetaildate = '2026-09-27 09:45:02' WHERE storedetailid = '45';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('45', '1', '7', '1', '139', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '68', '61', '1', '2026-09-27 09:45:02','0','0'); -- id=1990
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-321771.88',  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 ('-339617','17845.12', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '139', '-321771.88', '2026-09-27 09:45:02', '1',  'sellbillController.php','1','','0'); -- id=147
UPDATE dailyentry SET totalcreditor = '14960.25', totaldebtor = '14960.25', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 19:55:23', entryComment = 'اضافة فاتورة مبيعات رقم 137', fromFlag = '1',related='0',isopeningentry='0',operationId='137',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=137' WHERE id = '980';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14960.25', '14960.25', '2026-09-27', '1', '0', '980', '2026-09-27 09:45:02','تم عكس القيد رقم 980 ','1','0','0','0','0',''); -- id=986
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('986', '383', '14960.25', '','0'); -- id=986
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-245287.96', 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 ('986', '143', '14960.25', '','0'); -- id=986
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '458202.8', 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 = '14475.19', totaldebtor = '14475.19', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 19:55:23', entryComment = 'اضافة فاتورة مبيعات رقم 137 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='137',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=137' WHERE id = '981';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14475.19', '14475.19', '2026-09-27', '1', '0', '981', '2026-09-27 09:45:03','تم عكس القيد رقم 981 ','1','0','0','0','0',''); -- id=987
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('987', '402', '14475.19', '','0'); -- id=987
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '425302.73', 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 ('987', '382', '14475.19', '','0'); -- id=987
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2416900.74', 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 ( '17845.12', '17845.12', '2026-09-27', '1', '0', '0', '2026-09-27 09:45:03','اضافة فاتورة مبيعات رقم 139','1','0',null,'0','139','sellbillController.php?do=showDetail&sellbillid=139'); -- id=988
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('988', '383', '17845.12', '','0'); -- id=988
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-227442.84', 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 ('988', '143', '17845.12', '','0'); -- id=988
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '476047.92', 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 ( '17403.69', '17403.69', '2026-09-27', '1', '0', '0', '2026-09-27 09:45:03','اضافة فاتورة مبيعات رقم 139 - صرف البضاعة من المخزن','1','0',null,'0','139','sellbillController.php?do=showDetail&sellbillid=139'); -- id=989
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('989', '402', '17403.69', '','0'); -- id=989
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '442706.42', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('989', '382', '17403.69', '','0'); -- id=989
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2399497.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='988,0,989' where sellbillid=139;
 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-27', 17845.12, 17403.69, 17403.69
                    , 17403.69, 17403.69, 17403.69, 17403.69
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17403.69, 17403.69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17845.12, sellCostBuyPrice =sellCostBuyPrice+17403.69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17403.69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17403.69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17403.69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17403.69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17403.69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17403.69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17403.69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 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-27', 17845.12, 17403.69, 17403.69
                    , 17403.69, 17403.69, 17403.69, 17403.69
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17403.69, 17403.69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17845.12, sellCostBuyPrice =sellCostBuyPrice+17403.69
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17403.69, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17403.69
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17403.69, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17403.69
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17403.69
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17403.69
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17403.69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 17845.12, 17403.69, 17403.69
                    , 17403.69, 17403.69, 17403.69, 17403.69, 17403.69, 17403.69)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17845.12, netSellCostBuyPrice = netSellCostBuyPrice+17403.69
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+17403.69
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+17403.69
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+17403.69
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+17403.69
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+17403.69
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+17403.69
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+17403.69;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 137 and newid=139 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:15:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:45:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:45:05', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=139'); -- id=2530
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:15:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:45:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:45:21', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2531

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab8c080b13c5
-- ----------------------------------------------------------------------------------------------------

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-27 09:45:21', '06ab8c080b13c5', '1', '0.00', '0', '0', '1', '2650.00', '2650', '2650', '0', '1', '2026-09-27 09:45:21', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','2650','0','','0','0','2650','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-27','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=140
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','اضافة فاتورة مبيعات','140', '0', '2026-09-27 09:45:22', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-27 09:45:21','0','0','',''); -- id=236
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','00512', '140', '16', '512', '2', '295', '590', '0', '', '1', '2026-09-27 09:45:22', '512', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','590','0','','0','0.00','0','0','0','0'); -- id=975
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 975;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (512, '2026-09-27', 590, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+590, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 590, 550, 550
                    , 550, 550, 550, 550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 550, 550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+590, sellCostBuyPrice =sellCostBuyPrice+550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 09:45:22' WHERE storedetailid = '512';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('512', '1', '2', '1', '140', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '17', '1', '2026-09-27 09:45:22','0','0'); -- id=1991
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00516', '140', '16', '516', '4', '515', '2060', '0', '', '1', '2026-09-27 09:45:22', '516', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','515','2060','0','','0','0.00','0','0','0','0'); -- id=976
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 = 976;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (516, '2026-09-27', 2060, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2060, 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+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-27', 2060, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2060, 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 = '6', userid = '1', storedetaildate = '2026-09-27 09:45:22' WHERE storedetailid = '516';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('516', '1', '4', '1', '140', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '6', '1', '2026-09-27 09:45:22','0','0'); -- id=1992
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-319121.875',  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 ('-321771.875','2650', '0', '1', 'اضافة فاتورة مبيعات', '140', '-319121.875', '2026-09-27 09:45:22', '1',  'sellbillController.php','1','','0'); -- id=148
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2650', '2650', '2026-09-27', '1', '0', '0', '2026-09-27 09:45:22','اضافة فاتورة مبيعات رقم 140','1','0',null,'0','140','sellbillController.php?do=showDetail&sellbillid=140'); -- id=990
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('990', '383', '2650', '','0'); -- id=990
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-224792.84', 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 ('990', '143', '2650', '','0'); -- id=990
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '478697.92', 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-27', '1', '0', '0', '2026-09-27 09:45:22','اضافة فاتورة مبيعات رقم 140 - صرف البضاعة من المخزن','1','0',null,'0','140','sellbillController.php?do=showDetail&sellbillid=140'); -- id=991
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('991', '402', '2350', '','0'); -- id=991
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '445056.42', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('991', '382', '2350', '','0'); -- id=991
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2397147.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='990,0,991' where sellbillid=140;
 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-27', 2650, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2650, 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-27', 2650, 2350, 2350
                    , 2350, 2350, 2350, 2350
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2350, 2350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2650, 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, 2650, 2350, 2350
                    , 2350, 2350, 2350, 2350, 2350, 2350)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2650, 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 06ab8c080b13c5 and sellbillId = 140 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:15:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 09:45:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 09:45:23', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2532
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:50:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 10:20:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 10:20:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2533
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:51:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 10:21:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 10:21:01', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5&billtoret=139'); -- id=2534
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:51:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 10:21:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 10:21:28', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2535

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab8d1eedbc77
-- ----------------------------------------------------------------------------------------------------

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-27 10:21:29', '06ab8d1eedbc77', '1', '0.00', '0', '0', '1', '16140.9', '16140.9', '-16140.9', '0', '1', '2026-09-27 10:21:29', '', '1', '0', 'نقدي','1', '0', '5', '0', 'نقدي', '457', '0', '', '','','','-1','0','0','0','','0','-16140.9','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=10
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','اضافة فاتورة مردوات مبيعات','10', '0', '2026-09-27 10:21:29', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '16140.9', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-27 10:21:29','0','0','',''); -- id=237
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 ('44.33', '00041', '10', '1', '41', '90.00', '45.43', '4088.7', '0', '', '1', '0.00', '41', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','45.43','4088.7','0','','0'); -- id=24
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 24;
 INSERT INTO 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4088.7, 3989.7, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 0, 90, 0, 0, 3989.7, 3989.7)
                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+4088.7, returnSellCostBuyPrice = returnSellCostBuyPrice+3989.7, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3989.7
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3989.7, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3989.7
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3989.7
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3989.7
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3989.7
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+3989.7
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+90;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4088.7, 3989.7, 3989.7, 3989.7
                    , 3989.7, 3989.7, 3989.7, 0, 0, 3989.7, 3989.7)
                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+4088.7, returnSellCostBuyPrice = returnSellCostBuyPrice+3989.7, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+3989.7
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+3989.7, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+3989.7
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+3989.7
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+3989.7
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+3989.7
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+3989.7;
UPDATE storedetail SET  productquantity = '475', userid = '1', storedetaildate = '2026-09-27 10:21:30' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '90', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '385', '475', '1', '2026-09-27 10:21:30','0','0'); -- id=1993
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 ('29.50', '00042', '10', '1', '42', '90.00', '30.29', '2726.1', '0', '', '1', '0.00', '42', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','30.29','2726.1','0','','0'); -- id=25
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 25;
 INSERT INTO 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2726.1, 2655, 2655, 2655
                    , 2655, 2655, 2655, 0, 90, 0, 0, 2655, 2655)
                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+2726.1, returnSellCostBuyPrice = returnSellCostBuyPrice+2655, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2655
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2655, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2655
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2655
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2655
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2655
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2655
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+90;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2726.1, 2655, 2655, 2655
                    , 2655, 2655, 2655, 0, 0, 2655, 2655)
                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+2726.1, returnSellCostBuyPrice = returnSellCostBuyPrice+2655, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2655
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2655, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2655
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2655
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2655
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2655
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2655;
UPDATE storedetail SET  productquantity = '794', userid = '1', storedetaildate = '2026-09-27 10:21:30' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '90', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '704', '794', '1', '2026-09-27 10:21:30','0','0'); -- id=1994
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 ('29.50', '00043', '10', '1', '43', '75.00', '30.29', '2271.75', '0', '', '1', '0.00', '43', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','30.29','2271.75','0','','0'); -- id=26
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 26;
 INSERT INTO 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2271.75, 2212.5, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 0, 75, 0, 0, 2212.5, 2212.5)
                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+2271.75, returnSellCostBuyPrice = returnSellCostBuyPrice+2212.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2212.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2212.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2212.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2212.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2212.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2212.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2212.5
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+75;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 2271.75, 2212.5, 2212.5, 2212.5
                    , 2212.5, 2212.5, 2212.5, 0, 0, 2212.5, 2212.5)
                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+2271.75, returnSellCostBuyPrice = returnSellCostBuyPrice+2212.5, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+2212.5
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+2212.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+2212.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+2212.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+2212.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+2212.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+2212.5;
UPDATE storedetail SET  productquantity = '696', userid = '1', storedetaildate = '2026-09-27 10:21:30' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '75', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '621', '696', '1', '2026-09-27 10:21:30','0','0'); -- id=1995
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 ('191.00', '00376', '10', '1', '376', '8.00', '194', '1552', '0', '', '1', '0.00', '376', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','194','1552','0','','0'); -- id=27
UPDATE returnsellbilldetail SET  lastbuyprice = 191.00 , meanbuyprice = 191.00, lastbuyprice_withDiscount = 191.00, meanbuyprice_withDiscount = 191.00
        , lastbuyprice_withTax = 191, meanbuyprice_withTax = 191, lastbuyprice_withDiscountAndTax = 191
                where returnsellbilldetailid = 27;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (376, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1552, 1528, 1528, 1528
                    , 1528, 1528, 1528, 0, 8, 0, 0, 1528, 1528)
                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+1552, returnSellCostBuyPrice = returnSellCostBuyPrice+1528, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1528
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1528, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1528
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1528
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1528
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1528
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1528
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+8;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1552, 1528, 1528, 1528
                    , 1528, 1528, 1528, 0, 0, 1528, 1528)
                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+1552, returnSellCostBuyPrice = returnSellCostBuyPrice+1528, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1528
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1528, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1528
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1528
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1528
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1528
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1528;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-09-27 10:21:30' WHERE storedetailid = '376';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('376', '1', '8', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '8', '1', '2026-09-27 10:21:30','0','0'); -- id=1996
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 ('137.25', '00050', '10', '1', '50', '5.00', '141', '705', '0', '', '1', '0.00', '50', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','141','705','0','','0'); -- id=28
UPDATE returnsellbilldetail SET  lastbuyprice = 137.25 , meanbuyprice = 137.25, lastbuyprice_withDiscount = 137.25, meanbuyprice_withDiscount = 137.25
        , lastbuyprice_withTax = 137.25, meanbuyprice_withTax = 137.25, lastbuyprice_withDiscountAndTax = 137.25
                where returnsellbilldetailid = 28;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (50, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 705, 686.25, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 0, 5, 0, 0, 686.25, 686.25)
                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+705, returnSellCostBuyPrice = returnSellCostBuyPrice+686.25, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+686.25
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+686.25, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+686.25
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+686.25
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+686.25
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+686.25
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+686.25
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+5;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 705, 686.25, 686.25, 686.25
                    , 686.25, 686.25, 686.25, 0, 0, 686.25, 686.25)
                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+705, returnSellCostBuyPrice = returnSellCostBuyPrice+686.25, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+686.25
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+686.25, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+686.25
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+686.25
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+686.25
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+686.25
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+686.25;
UPDATE storedetail SET  productquantity = '66', userid = '1', storedetaildate = '2026-09-27 10:21:31' WHERE storedetailid = '50';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('50', '1', '5', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '61', '66', '1', '2026-09-27 10:21:31','0','0'); -- id=1997
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('52.79', '00048', '10', '1', '48', '3.00', '54.1', '162.3', '0', '', '1', '0.00', '48', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','54.1','162.3','0','','0'); -- id=29
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 29;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (48, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 162.3, 158.37, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 0, 3, 0, 0, 158.37, 158.37)
                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+162.3, returnSellCostBuyPrice = returnSellCostBuyPrice+158.37, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+158.37
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+158.37, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+158.37
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+158.37
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+158.37
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+158.37
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+158.37
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 162.3, 158.37, 158.37, 158.37
                    , 158.37, 158.37, 158.37, 0, 0, 158.37, 158.37)
                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+162.3, returnSellCostBuyPrice = returnSellCostBuyPrice+158.37, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+158.37
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+158.37, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+158.37
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+158.37
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+158.37
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+158.37
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+158.37;
UPDATE storedetail SET  productquantity = '120', userid = '1', storedetaildate = '2026-09-27 10:21:31' WHERE storedetailid = '48';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('48', '1', '3', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '117', '120', '1', '2026-09-27 10:21:31','0','0'); -- id=1998
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 ('254.00', '00314', '10', '1', '314', '3.00', '259.7', '779.1', '0', '', '1', '0.00', '314', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','259.7','779.1','0','','0'); -- id=30
UPDATE returnsellbilldetail SET  lastbuyprice = 254.00 , meanbuyprice = 254.00, lastbuyprice_withDiscount = 254.00, meanbuyprice_withDiscount = 254.00
        , lastbuyprice_withTax = 254, meanbuyprice_withTax = 254, lastbuyprice_withDiscountAndTax = 254
                where returnsellbilldetailid = 30;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (314, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 779.1, 762, 762, 762
                    , 762, 762, 762, 0, 3, 0, 0, 762, 762)
                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+779.1, returnSellCostBuyPrice = returnSellCostBuyPrice+762, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+762
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+762, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+762
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+762
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+762
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+762
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+762
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 779.1, 762, 762, 762
                    , 762, 762, 762, 0, 0, 762, 762)
                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+779.1, returnSellCostBuyPrice = returnSellCostBuyPrice+762, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+762
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+762, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+762
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+762
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+762
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+762
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+762;
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-09-27 10:21:31' WHERE storedetailid = '314';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('314', '1', '3', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '3', '6', '1', '2026-09-27 10:21:31','0','0'); -- id=1999
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 ('50.67', '00053', '10', '1', '53', '6.00', '52', '312', '0', '', '1', '0.00', '53', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','52','312','0','','0'); -- id=31
UPDATE returnsellbilldetail SET  lastbuyprice = 50.67 , meanbuyprice = 50.67, lastbuyprice_withDiscount = 50.67, meanbuyprice_withDiscount = 50.67
        , lastbuyprice_withTax = 50.67, meanbuyprice_withTax = 50.67, lastbuyprice_withDiscountAndTax = 50.67
                where returnsellbilldetailid = 31;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (53, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 312, 304.02, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 0, 6, 0, 0, 304.02, 304.02)
                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+312, returnSellCostBuyPrice = returnSellCostBuyPrice+304.02, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+304.02
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+304.02, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+304.02
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+304.02
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+304.02
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+304.02
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+304.02
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+6;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 312, 304.02, 304.02, 304.02
                    , 304.02, 304.02, 304.02, 0, 0, 304.02, 304.02)
                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+312, returnSellCostBuyPrice = returnSellCostBuyPrice+304.02, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+304.02
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+304.02, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+304.02
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+304.02
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+304.02
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+304.02
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+304.02;
UPDATE storedetail SET  productquantity = '77', userid = '1', storedetaildate = '2026-09-27 10:21:31' WHERE storedetailid = '53';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('53', '1', '6', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '71', '77', '1', '2026-09-27 10:21:31','0','0'); -- id=2000
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 ('100.30', '00049', '10', '1', '49', '2.00', '102.8', '205.6', '0', '', '1', '0.00', '49', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','102.8','205.6','0','','0'); -- id=32
UPDATE returnsellbilldetail SET  lastbuyprice = 100.30 , meanbuyprice = 100.30, lastbuyprice_withDiscount = 100.30, meanbuyprice_withDiscount = 100.30
        , lastbuyprice_withTax = 100.3, meanbuyprice_withTax = 100.3, lastbuyprice_withDiscountAndTax = 100.3
                where returnsellbilldetailid = 32;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (49, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 205.6, 200.6, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 0, 2, 0, 0, 200.6, 200.6)
                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+205.6, returnSellCostBuyPrice = returnSellCostBuyPrice+200.6, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+200.6
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+200.6, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+200.6
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+200.6
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+200.6
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+200.6
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+200.6
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+2;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 205.6, 200.6, 200.6, 200.6
                    , 200.6, 200.6, 200.6, 0, 0, 200.6, 200.6)
                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+205.6, returnSellCostBuyPrice = returnSellCostBuyPrice+200.6, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+200.6
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+200.6, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+200.6
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+200.6
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+200.6
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+200.6
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+200.6;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-09-27 10:21:31' WHERE storedetailid = '49';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('49', '1', '2', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '-2', '0', '1', '2026-09-27 10:21:31','0','0'); -- id=2001
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 ('89.70', '00046', '10', '1', '46', '10.00', '92.5', '925', '0', '', '1', '0.00', '46', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','92.5','925','0','','0'); -- id=33
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 33;
 INSERT INTO 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 925, 897, 897, 897
                    , 897, 897, 897, 0, 10, 0, 0, 897, 897)
                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+925, returnSellCostBuyPrice = returnSellCostBuyPrice+897, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+897
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+897, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+897
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+897
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+897
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+897
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+897
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+10;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 925, 897, 897, 897
                    , 897, 897, 897, 0, 0, 897, 897)
                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+925, returnSellCostBuyPrice = returnSellCostBuyPrice+897, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+897
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+897, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+897
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+897
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+897
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+897
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+897;
UPDATE storedetail SET  productquantity = '95', userid = '1', storedetaildate = '2026-09-27 10:21:31' WHERE storedetailid = '46';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('46', '1', '10', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '85', '95', '1', '2026-09-27 10:21:32','0','0'); -- id=2002
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 ('89.70', '00047', '10', '1', '47', '10.00', '92.5', '925', '0', '', '1', '0.00', '47', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','92.5','925','0','','0'); -- id=34
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 34;
 INSERT INTO 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 925, 897, 897, 897
                    , 897, 897, 897, 0, 10, 0, 0, 897, 897)
                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+925, returnSellCostBuyPrice = returnSellCostBuyPrice+897, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+897
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+897, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+897
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+897
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+897
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+897
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+897
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+10;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 925, 897, 897, 897
                    , 897, 897, 897, 0, 0, 897, 897)
                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+925, returnSellCostBuyPrice = returnSellCostBuyPrice+897, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+897
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+897, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+897
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+897
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+897
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+897
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+897;
UPDATE storedetail SET  productquantity = '104', userid = '1', storedetaildate = '2026-09-27 10:21:32' WHERE storedetailid = '47';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('47', '1', '10', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '94', '104', '1', '2026-09-27 10:21:32','0','0'); -- id=2003
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 ('36.95', '00051', '10', '1', '51', '5.00', '37.87', '189.35', '0', '', '1', '0.00', '51', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','37.87','189.35','0','','0'); -- id=35
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 35;
 INSERT INTO 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 189.35, 184.75, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 0, 5, 0, 0, 184.75, 184.75)
                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+189.35, returnSellCostBuyPrice = returnSellCostBuyPrice+184.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+184.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+184.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+184.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+184.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+184.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+184.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+184.75
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+5;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 189.35, 184.75, 184.75, 184.75
                    , 184.75, 184.75, 184.75, 0, 0, 184.75, 184.75)
                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+189.35, returnSellCostBuyPrice = returnSellCostBuyPrice+184.75, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+184.75
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+184.75, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+184.75
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+184.75
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+184.75
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+184.75
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+184.75;
UPDATE storedetail SET  productquantity = '86', userid = '1', storedetaildate = '2026-09-27 10:21:32' WHERE storedetailid = '51';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('51', '1', '5', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '81', '86', '1', '2026-09-27 10:21:32','0','0'); -- id=2004
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 ('8.44', '00044', '10', '1', '44', '150.00', '8.66', '1299', '0', '', '1', '0.00', '44', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','8.66','1299','0','','0'); -- id=36
UPDATE returnsellbilldetail 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 returnsellbilldetailid = 36;
 INSERT INTO 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1299, 1266, 1266, 1266
                    , 1266, 1266, 1266, 0, 150, 0, 0, 1266, 1266)
                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+1299, returnSellCostBuyPrice = returnSellCostBuyPrice+1266, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1266
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1266, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1266
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1266
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1266
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1266
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1266
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+150;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1299, 1266, 1266, 1266
                    , 1266, 1266, 1266, 0, 0, 1266, 1266)
                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+1299, returnSellCostBuyPrice = returnSellCostBuyPrice+1266, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1266
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1266, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1266
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1266
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1266
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1266
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1266;
UPDATE storedetail SET  productquantity = '1030', userid = '1', storedetaildate = '2026-09-27 10:21:32' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '150', '0', '10', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '880', '1030', '1', '2026-09-27 10:21:32','0','0'); -- id=2005
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-335262.775',  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 ('-319121.875','-16140.9', '1', '1', 'اضافة فاتورة مردوات مبيعات', '10', '-335262.775', '2026-09-27 10:21:33', '1',  'returnsellbillController.php','1','','0'); -- id=149
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16140.9', '16140.9', '2026-09-27', '1', '0', '0', '2026-09-27 10:21:33','اضافة فاتورة مردود مبيعات رقم 10','1','0',null,'0','10','returnsellbillController.php?do=showDetail&returnsellbillid=10'); -- id=992
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('992', '143', '16140.9', '','0'); -- id=992
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '462557.02', 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 ('992', '383', '16140.9', '','0'); -- id=992
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-240933.74', 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 ( '15741.19', '15741.19', '2026-09-27', '1', '0', '0', '2026-09-27 10:21:33','اضافة فاتورة مردود مبيعات رقم 10 - صرف البضاعة من المخزن','1','0',null,'0','10','returnsellbillController.php?do=showDetail&returnsellbillid=10'); -- id=993
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('993', '382', '15741.19', '','0'); -- id=993
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2412888.24', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('993', '402', '15741.19', '','0'); -- id=993
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '429315.23', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='992,0,993' where returnsellbillid=10;
 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 16140.9, 15741.19, 15741.19, 15741.19
                    , 15741.19, 15741.19, 15741.19 ,0, 0, 15741.19, 15741.19)
                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+16140.9, returnSellCostBuyPrice = returnSellCostBuyPrice+15741.19, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+15741.19
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+15741.19, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+15741.19
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+15741.19
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+15741.19
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+15741.19
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+15741.19;
 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-27', 0, 0, 0
                    , 0, 0, 0, 0
                    , 16140.9, 15741.19, 15741.19, 15741.19
                    , 15741.19, 15741.19, 15741.19 ,0, 0, 15741.19, 15741.19)
                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+16140.9, returnSellCostBuyPrice = returnSellCostBuyPrice+15741.19, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+15741.19
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+15741.19, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+15741.19
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+15741.19
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+15741.19
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+15741.19
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+15741.19;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -16140.9, -15741.19, -15741.19
                    , -15741.19, -15741.19, -15741.19, -15741.19, -15741.19, -15741.19)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-16140.9, netSellCostBuyPrice = netSellCostBuyPrice+-15741.19
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-15741.19
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-15741.19
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-15741.19
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-15741.19
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-15741.19
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-15741.19
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-15741.19;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab8d1eedbc77 and sellbillId = 10 and returnsellbillId = 10
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:51:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 10:21:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 10:21:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=2536
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:51:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 10:21:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-27 10:21:54', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=2537
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:51:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 10:21:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-27 10:21:55', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2538
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 06:51:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 10:21:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-27 10:21:59', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2539
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 07:37:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:07:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 11:07:50', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2540
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 07:38:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:08:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 11:08:44', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2541

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab8dce785039
-- ----------------------------------------------------------------------------------------------------

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-27 11:08:45', '06ab8dce785039', '1', '0.00', '0', '0', '1', '3238.50', '3238.5', '3238.5', '0', '1', '2026-09-27 11:08:45', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '38.25' ,'0','','','','','-1','0','0','0','0','0','3238','0','','0','0','3238.5','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-27','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=141
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','اضافة فاتورة مبيعات','141', '0', '2026-09-27 11:08:45', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3238.5', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-27 11:08:45','0','0','',''); -- id=238
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 45;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('332','00070', '141', '12', '70', '7', '380', '2660', '0', '', '1', '2026-09-27 11:08:45', '70', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','45-7,','1','1','0','0','380','2660','0','','0','0.00','0','0','0','0'); -- id=977
UPDATE sellbilldetail SET  lastbuyprice = 332.00 , meanbuyprice = 321.76, lastbuyprice_withDiscount = 332.00, meanbuyprice_withDiscount = 321.76
        , lastbuyprice_withTax = 332, meanbuyprice_withTax = 321.76, lastbuyprice_withDiscountAndTax = 332
                where sellbilldetailid = 977;
 INSERT INTO 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-27', 2660, 2324, 2324
                    , 2252.32, 2324, 2252.32, 2324
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 2324, 2252.32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2660, sellCostBuyPrice =sellCostBuyPrice+2324
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2324, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2252.32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2324, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2252.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2324
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2324
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2252.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+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-27', 2660, 2324, 2324
                    , 2252.32, 2324, 2252.32, 2324
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2324, 2252.32, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2660, sellCostBuyPrice =sellCostBuyPrice+2324
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2324, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2252.32
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2324, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2252.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2324
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2324
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2252.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 = '55', userid = '1', storedetaildate = '2026-09-27 11:08:45' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '7', '1', '141', 'اضافة فاتورة مبيعات', 'sellbillController.php', '62', '55', '1', '2026-09-27 11:08:45','0','0'); -- id=2006
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('415','00073', '141', '12', '73', '1', '475', '475', '0', '', '1', '2026-09-27 11:08:45', '73', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','46-1,','1','1','0','0','475','475','0','','0','0.00','0','0','0','0'); -- id=978
UPDATE sellbilldetail SET  lastbuyprice = 415.00 , meanbuyprice = 407.05, lastbuyprice_withDiscount = 415.00, meanbuyprice_withDiscount = 407.05
        , lastbuyprice_withTax = 415, meanbuyprice_withTax = 407.05, lastbuyprice_withDiscountAndTax = 415
                where sellbilldetailid = 978;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (73, '2026-09-27', 475, 415, 415
                    , 407.05, 415, 407.05, 415
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 415, 407.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+415
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+415, sellCostMeanBuyPrice = sellCostMeanBuyPrice+407.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+415, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+407.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+415
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+415
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+407.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 475, 415, 415
                    , 407.05, 415, 407.05, 415
                    , 0, 0, 0, 0
                    , 0, 0, 0, 415, 407.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+475, sellCostBuyPrice =sellCostBuyPrice+415
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+415, sellCostMeanBuyPrice = sellCostMeanBuyPrice+407.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+415, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+407.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+415
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+415
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+407.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 11:08:46' WHERE storedetailid = '73';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '1', '1', '1', '141', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '17', '1', '2026-09-27 11:08:46','0','0'); -- id=2007
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2.75','00074', '141', '12', '74', '30', '2.95', '88.5', '0', '', '1', '2026-09-27 11:08:46', '74', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2.95','88.5','0','','0','0.00','0','0','0','0'); -- id=979
UPDATE sellbilldetail SET  lastbuyprice = 2.75 , meanbuyprice = 2.75, lastbuyprice_withDiscount = 2.75, meanbuyprice_withDiscount = 2.75
        , lastbuyprice_withTax = 2.75, meanbuyprice_withTax = 2.75, lastbuyprice_withDiscountAndTax = 2.75
                where sellbilldetailid = 979;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (74, '2026-09-27', 88.5, 82.5, 82.5
                    , 82.5, 82.5, 82.5, 82.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 82.5, 82.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+88.5, sellCostBuyPrice =sellCostBuyPrice+82.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+82.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+82.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+82.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+82.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+82.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+82.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+82.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+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-27', 88.5, 82.5, 82.5
                    , 82.5, 82.5, 82.5, 82.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 82.5, 82.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+88.5, sellCostBuyPrice =sellCostBuyPrice+82.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+82.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+82.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+82.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+82.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+82.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+82.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+82.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 = '290', userid = '1', storedetaildate = '2026-09-27 11:08:46' WHERE storedetailid = '74';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('74', '1', '30', '1', '141', 'اضافة فاتورة مبيعات', 'sellbillController.php', '320', '290', '1', '2026-09-27 11:08:46','0','0'); -- id=2008
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00077', '141', '12', '77', '.25', '60', '15', '0', '', '1', '2026-09-27 11:08:46', '77', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','60','15','0','','0','0.00','0','0','0','0'); -- id=980
UPDATE sellbilldetail SET  lastbuyprice = 55.00 , meanbuyprice = 55.00, lastbuyprice_withDiscount = 55.00, meanbuyprice_withDiscount = 55.00
        , lastbuyprice_withTax = 55, meanbuyprice_withTax = 55, lastbuyprice_withDiscountAndTax = 55
                where sellbilldetailid = 980;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (77, '2026-09-27', 15, 13.75, 13.75
                    , 13.75, 13.75, 13.75, 13.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.25, 0, 13.75, 13.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13.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+0.25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 15, 13.75, 13.75
                    , 13.75, 13.75, 13.75, 13.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13.75, 13.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15, sellCostBuyPrice =sellCostBuyPrice+13.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13.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 = '4.8', userid = '1', storedetaildate = '2026-09-27 11:08:46' WHERE storedetailid = '77';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('77', '1', '0.25', '1', '141', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5.05', '4.8', '1', '2026-09-27 11:08:46','0','0'); -- id=2009
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-332024.28125',  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 ('-335262.78125','3238.5', '0', '1', 'اضافة فاتورة مبيعات', '141', '-332024.28125', '2026-09-27 11:08:46', '1',  'sellbillController.php','1','','0'); -- id=150
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3238.5', '3238.5', '2026-09-27', '1', '0', '0', '2026-09-27 11:08:47','اضافة فاتورة مبيعات رقم 141','1','0',null,'0','141','sellbillController.php?do=showDetail&sellbillid=141'); -- id=994
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('994', '383', '3238.5', '','0'); -- id=994
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-237695.24', 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 ('994', '143', '3238.5', '','0'); -- id=994
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '465795.52', 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 ( '2835.25', '2835.25', '2026-09-27', '1', '0', '0', '2026-09-27 11:08:47','اضافة فاتورة مبيعات رقم 141 - صرف البضاعة من المخزن','1','0',null,'0','141','sellbillController.php?do=showDetail&sellbillid=141'); -- id=995
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('995', '402', '2835.25', '','0'); -- id=995
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '432150.48', 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 ('995', '382', '2835.25', '','0'); -- id=995
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2410052.99', 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='994,0,995' where sellbillid=141;
 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-27', 3238.5, 2835.25, 2835.25
                    , 2755.62, 2835.25, 2755.62, 2835.25
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2835.25, 2755.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3238.5, sellCostBuyPrice =sellCostBuyPrice+2835.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2835.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2755.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2835.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2755.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2835.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2835.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2755.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 3238.5, 2835.25, 2835.25
                    , 2755.62, 2835.25, 2755.62, 2835.25
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2835.25, 2755.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3238.5, sellCostBuyPrice =sellCostBuyPrice+2835.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2835.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2755.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2835.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2755.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2835.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2835.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2755.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3238.5, 2835.25, 2835.25
                    , 2755.62, 2835.25, 2755.62, 2835.25, 2835.25, 2755.62)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3238.5, netSellCostBuyPrice = netSellCostBuyPrice+2835.25
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2835.25
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2755.62
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2835.25
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2755.62
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2835.25
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2835.25
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2755.62;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab8dce785039 and sellbillId = 141 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 07:38:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:08:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 11:08:48', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2542
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 07:54:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:24:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 11:24:58', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2543
UPDATE productunit SET unitid = '1', productid = '70', productnumber = '1.00', productunitdate = '2026-09-14', userid = '1', conditions = '0',proUnitParcode='0007001',proUnitSellAllPrice='380',proUnitSellHalfPrice='380',proUnitSellUnitPrice ='380',proUnitBuyPrice='332',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '70';
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو احمر', productDescription = '', productCatId = '12', productBuyPrice = '348', productSellAllPrice = '380', productSellUnitPrice = '380', productSellHalfPrice = '380', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '20', parcode = '00070',type ='0', expireDate = '0' , dailyentryId = '82',isService = '0',isOptic = '0',lastbuyprice = '332.00',lastbuyprice_withDiscount = '332',meanbuyprice = '321.76',meanbuyprice_withDiscount = '321.76' , productbuypricereal = '312' , buypricereal_precentage = '0' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='332',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='332',meanbuyprice_withTax='321.76',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='332',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '70';
UPDATE productunit SET unitid = '1', productid = '73', productnumber = '1.00', productunitdate = '2026-09-14', userid = '1', conditions = '0',proUnitParcode='0007301',proUnitSellAllPrice='475',proUnitSellHalfPrice='475',proUnitSellUnitPrice ='475',proUnitBuyPrice='415',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '73';
UPDATE product SET productName = 'لفه خرطوم 23 ملي مصطفي محمود 5 كيلو', productDescription = '', productCatId = '12', productBuyPrice = '435', productSellAllPrice = '475', productSellUnitPrice = '475', productSellHalfPrice = '475', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '5', parcode = '00073',type ='0', expireDate = '0' , dailyentryId = '85',isService = '0',isOptic = '0',lastbuyprice = '415.00',lastbuyprice_withDiscount = '415',meanbuyprice = '407.05',meanbuyprice_withDiscount = '407.05' , productbuypricereal = '390' , buypricereal_precentage = '0' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='415',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='415',meanbuyprice_withTax='407.05',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='415',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '73';
UPDATE productunit SET unitid = '1', productid = '74', productnumber = '1.00', productunitdate = '2026-09-14', userid = '1', conditions = '0',proUnitParcode='0007401',proUnitSellAllPrice='2.85',proUnitSellHalfPrice='2.85',proUnitSellUnitPrice ='2.95',proUnitBuyPrice='2.75',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '74';
UPDATE product SET productName = 'علبه 4 مخرج اصلي ', productDescription = '', productCatId = '12', productBuyPrice = '2.5', productSellAllPrice = '2.85', productSellUnitPrice = '2.95', productSellHalfPrice = '2.85', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '200', parcode = '00074',type ='0', expireDate = '0' , dailyentryId = '86',isService = '0',isOptic = '0',lastbuyprice = '2.75',lastbuyprice_withDiscount = '2.75',meanbuyprice = '2.75',meanbuyprice_withDiscount = '2.75' , productbuypricereal = '2.75' , buypricereal_precentage = '0' , buytotal_precentage = '3.64' , buyhalf_precentage = '3.64' , buypart_precentage = '7.27',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2.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='2.75',meanbuyprice_withTax='2.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='2.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 = '74';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:03:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:33:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 11:33:57', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2544
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 ('06ab8e0f29ac3d', '2026-09-27 11:25:06', '1', '42113.50', '42113.5', '0', '0', '31005.00',  '31005.00', '31005', '0', '1', '2026-09-27 11:33:57', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=28
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 ('00084', '28', '12', '84', '30', '160', '4800.00', '0', '', '2026-09-27 11:33:57', '84','','','0','0','0','0','0',null,'160','4800','0','0','0','0','0','0','0','0','1'); -- id=100
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 11:25:06', 1, 84, 0, 0
                    , 160, 30, 0, 0, 1, '2026-09-27 11:33:58')
                ON DUPLICATE KEY UPDATE buyprice = 160,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 11:33:58' ; -- id=100
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('84', '160', '30', '0', 'buyBillController.php', '100', '', '0', '0'); -- id=100
UPDATE product SET  productBuyPrice = "160" WHERE productId = 84 ;
UPDATE buybilldetail SET  quantitybefore = 27 WHERE buybilldetailid = 100 ;
UPDATE product SET productName = 'لفه سوسته وير 16 ملي 30 متر بيور', productDescription = '', productCatId = '12', productBuyPrice = '160.00', productSellAllPrice = '180.00', productSellUnitPrice = '195.00', productSellHalfPrice = '180.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00084',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '160',lastbuyprice_withDiscount = '160',meanbuyprice = '160',meanbuyprice_withDiscount = '160' , productbuypricereal = '160.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '12.50' , buyhalf_precentage = '12.50' , buypart_precentage = '21.88',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='160',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='160',meanbuyprice_withTax='160',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='160',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '84';
UPDATE buybilldetail SET  lastbuyprice = 160 , meanbuyprice = 160, lastbuyprice_withDiscount = 160, meanbuyprice_withDiscount = 160
        , lastbuyprice_withTax = 160, meanbuyprice_withTax = 160, lastbuyprice_withDiscountAndTax = 160
                where buybilldetailid = 100;
UPDATE productunit SET proUnitBuyPrice  = 160 * productnumber WHERE productid = 84;
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '84';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('84', '1', '30', '0', '28', 'اضافة فاتورة مشتريات', 'buyBillController.php', '27', '57', '1', '2026-09-27 11:25:06','0','0'); -- id=2010
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 ('00085', '28', '12', '85', '10', '250', '2500.00', '0', '', '2026-09-27 11:33:57', '85','','','0','0','0','0','0',null,'250','2500','0','0','0','0','0','0','0','0','1'); -- id=101
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 11:25:06', 1, 85, 0, 0
                    , 250, 10, 0, 0, 1, '2026-09-27 11:33:59')
                ON DUPLICATE KEY UPDATE buyprice = 250,
                        buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 11:33:59' ; -- id=101
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('85', '250', '10', '0', 'buyBillController.php', '101', '', '0', '0'); -- id=101
UPDATE product SET  productBuyPrice = "250" WHERE productId = 85 ;
UPDATE buybilldetail SET  quantitybefore = 19 WHERE buybilldetailid = 101 ;
UPDATE product SET productName = 'لفه سوسته وير 23 ملي 30 متر بيور', productDescription = '', productCatId = '12', productBuyPrice = '250.00', productSellAllPrice = '265.00', productSellUnitPrice = '285.00', productSellHalfPrice = '285.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00085',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '250',lastbuyprice_withDiscount = '250',meanbuyprice = '250',meanbuyprice_withDiscount = '250' , productbuypricereal = '250.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.00' , buyhalf_precentage = '14.00' , buypart_precentage = '14.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='250',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='250',meanbuyprice_withTax='250',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='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 = '85';
UPDATE buybilldetail SET  lastbuyprice = 250 , meanbuyprice = 250, lastbuyprice_withDiscount = 250, meanbuyprice_withDiscount = 250
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where buybilldetailid = 101;
UPDATE productunit SET proUnitBuyPrice  = 250 * productnumber WHERE productid = 85;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '85';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('85', '1', '10', '0', '28', 'اضافة فاتورة مشتريات', 'buyBillController.php', '19', '29', '1', '2026-09-27 11:25:06','0','0'); -- id=2011
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 ('00070', '28', '12', '70', '40', '348', '13920.00', '0', '', '2026-09-27 11:33:57', '70','','','0','0','0','0','0',null,'348','13920','0','0','0','0','0','0','0','0','1'); -- id=102
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 11:25:06', 1, 70, 0, 0
                    , 348, 40, 0, 0, 1, '2026-09-27 11:33:59')
                ON DUPLICATE KEY UPDATE buyprice = 348,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 11:33:59' ; -- id=102
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('70', '348', '40', '0', 'buyBillController.php', '102', '', '0', '0'); -- id=102
UPDATE product SET  productBuyPrice = "348" WHERE productId = 70 ;
UPDATE buybilldetail SET  quantitybefore = 55 WHERE buybilldetailid = 102 ;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو احمر', productDescription = '', productCatId = '12', productBuyPrice = '348.00', productSellAllPrice = '380.00', productSellUnitPrice = '380.00', productSellHalfPrice = '380.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '20', parcode = '00070',type ='0', expireDate = '0' , dailyentryId = '82',isService = '0',isOptic = '0',lastbuyprice = '348',lastbuyprice_withDiscount = '348',meanbuyprice = '332.81',meanbuyprice_withDiscount = '332.81' , productbuypricereal = '312.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='332',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='348',meanbuyprice_withTax='332.81',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='348',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '70';
UPDATE buybilldetail SET  lastbuyprice = 348 , meanbuyprice = 332.81, lastbuyprice_withDiscount = 348, meanbuyprice_withDiscount = 332.81
        , lastbuyprice_withTax = 348, meanbuyprice_withTax = 332.81, lastbuyprice_withDiscountAndTax = 348
                where buybilldetailid = 102;
UPDATE productunit SET proUnitBuyPrice  = 348 * productnumber WHERE productid = 70;
UPDATE storedetail SET  productquantity = '95', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '70';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('70', '1', '40', '0', '28', 'اضافة فاتورة مشتريات', 'buyBillController.php', '55', '95', '1', '2026-09-27 11:25:06','0','0'); -- id=2012
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 ('00073', '28', '12', '73', '11', '435', '4785.00', '0', '', '2026-09-27 11:33:57', '73','','','0','0','0','0','0',null,'435','4785','0','0','0','0','0','0','0','0','1'); -- id=103
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 11:25:06', 1, 73, 0, 0
                    , 435, 11, 0, 0, 1, '2026-09-27 11:34:00')
                ON DUPLICATE KEY UPDATE buyprice = 435,
                        buyQuantity =buyQuantity+11, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 11:34:00' ; -- id=103
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('73', '435', '11', '0', 'buyBillController.php', '103', '', '0', '0'); -- id=103
UPDATE product SET  productBuyPrice = "435" WHERE productId = 73 ;
UPDATE buybilldetail SET  quantitybefore = 17 WHERE buybilldetailid = 103 ;
UPDATE product SET productName = 'لفه خرطوم 23 ملي مصطفي محمود 5 كيلو', productDescription = '', productCatId = '12', productBuyPrice = '435.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '5', parcode = '00073',type ='0', expireDate = '0' , dailyentryId = '85',isService = '0',isOptic = '0',lastbuyprice = '435',lastbuyprice_withDiscount = '435',meanbuyprice = '418.03',meanbuyprice_withDiscount = '418.03' , productbuypricereal = '390.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '5.13',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='415',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='435',meanbuyprice_withTax='418.03',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='435',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '73';
UPDATE buybilldetail SET  lastbuyprice = 435 , meanbuyprice = 418.03, lastbuyprice_withDiscount = 435, meanbuyprice_withDiscount = 418.03
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 418.03, lastbuyprice_withDiscountAndTax = 435
                where buybilldetailid = 103;
UPDATE productunit SET proUnitBuyPrice  = 435 * productnumber WHERE productid = 73;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '73';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('73', '1', '11', '0', '28', 'اضافة فاتورة مشتريات', 'buyBillController.php', '17', '28', '1', '2026-09-27 11:25:06','0','0'); -- id=2013
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 ('00074', '28', '12', '74', '2000', '2.5', '5000.00', '0', '', '2026-09-27 11:33:57', '74','','','0','0','0','0','0',null,'2.5','5000','0','0','0','0','0','0','0','0','1'); -- id=104
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 11:25:06', 1, 74, 0, 0
                    , 2.5, 2000, 0, 0, 1, '2026-09-27 11:34:00')
                ON DUPLICATE KEY UPDATE buyprice = 2.5,
                        buyQuantity =buyQuantity+2000, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 11:34:00' ; -- id=104
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('74', '2.5', '2000', '0', 'buyBillController.php', '104', '', '0', '0'); -- id=104
UPDATE product SET  productBuyPrice = "2.5" WHERE productId = 74 ;
UPDATE buybilldetail SET  quantitybefore = 290 WHERE buybilldetailid = 104 ;
UPDATE product SET productName = 'علبه 4 مخرج اصلي ', productDescription = '', productCatId = '12', productBuyPrice = '2.50', productSellAllPrice = '2.85', productSellUnitPrice = '2.95', productSellHalfPrice = '2.85', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '200', parcode = '00074',type ='0', expireDate = '0' , dailyentryId = '86',isService = '0',isOptic = '0',lastbuyprice = '2.5',lastbuyprice_withDiscount = '2.5',meanbuyprice = '2.53',meanbuyprice_withDiscount = '2.53' , productbuypricereal = '2.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.64' , buyhalf_precentage = '3.64' , buypart_precentage = '7.27',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2.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='2.5',meanbuyprice_withTax='2.53',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='2.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 = '74';
UPDATE buybilldetail SET  lastbuyprice = 2.5 , meanbuyprice = 2.53, lastbuyprice_withDiscount = 2.5, meanbuyprice_withDiscount = 2.53
        , lastbuyprice_withTax = 2.5, meanbuyprice_withTax = 2.53, lastbuyprice_withDiscountAndTax = 2.5
                where buybilldetailid = 104;
UPDATE productunit SET proUnitBuyPrice  = 2.5 * productnumber WHERE productid = 74;
UPDATE storedetail SET  productquantity = '2290', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '74';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('74', '1', '2000', '0', '28', 'اضافة فاتورة مشتريات', 'buyBillController.php', '290', '2290', '1', '2026-09-27 11:25:06','0','0'); -- id=2014
UPDATE supplier SET  suppliercurrentDebt = '42113.5',suppliercurrentDebtInCurrency= '42113.5' , userid = '1', supplierdate = '2026-09-27 11:33:57'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '42113.50', '0', '0', 'اضافة فاتورة مشتريات', '28', '42113.5', '2026-09-27 11:25:06', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','42113.5','0','42113.5','0',''); -- id=54
UPDATE save SET  savecurrentvalue = '-363029.28',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-332024.28','31005', '1', '1', 'اضافة فاتورة مشتريات', '28', '-363029.28', '2026-09-27 11:25:06', '1',  'buyBillController.php','0','','0'); -- id=151
update buybill set dailyentryid='0,0' where buybillid=28;
COMMIT;
UPDATE product SET overAllAveragePrice = 340 WHERE productId = 70;UPDATE product SET overAllAveragePrice = 423.46 WHERE productId = 73;UPDATE product SET overAllAveragePrice = 2.5 WHERE productId = 74;UPDATE product SET overAllAveragePrice = 160 WHERE productId = 84;UPDATE product SET overAllAveragePrice = 250 WHERE productId = 85;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:04:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:34:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 11:34:02', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=28'); -- id=2545
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:07:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:37:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 11:37:46', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2546
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:07:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 11:37:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 11:37:53', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2547
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:47:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:17:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-27 12:17:27', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=2548
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:47:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:17:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-09-27 12:17:28', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=2549
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:47:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:17:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 12:17:31', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2550
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:47:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:17:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 12:17:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2551
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:47:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:17:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2026-09-27 12:17:59', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/returnsellbillController.php?do=showDetail&returnsellbillid=8'); -- id=2552
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:48:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:18:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 12:18:14', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2553
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:48:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:18:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 12:18:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2554
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:48:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:18:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 12:18:27', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=132'); -- id=2555
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:48:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:18:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 12:18:29', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=editprint&id=220'); -- id=2556
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 08:49:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:19:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2026-09-27 12:19:13', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/returnsellbillController.php?do=showDetail&returnsellbillid=8'); -- id=2557
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:07:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:37:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-09-27 12:37:30', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierController.php?do=show'); -- id=2558
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:18:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:48:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 12:48:30', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2559
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:18:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:48:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 12:48:41', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2560
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:18:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:48:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 12:48:49', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=134'); -- id=2561
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:19:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:49:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 12:49:08', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2562
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 134;
UPDATE sellbill SET  sellbillsysdate = '2026-09-27 12:49:09', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '134';
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 = 939;
 INSERT INTO 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-27', 6050, 5100, 5100
                    , 5100, 5100, 5100, 5100
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 5100, 5100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6050, sellCostBuyPrice =sellCostBuyPrice-5100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 6050, 5100, 5100
                    , 5100, 5100, 5100, 5100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5100, 5100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6050, sellCostBuyPrice =sellCostBuyPrice-5100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-09-27 12:49:09' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '5', '0', '134', 'تعديل فاتورة مبيعات', 'sellbillController.php', '43', '48', '1', '2026-09-26 16:55:00','0','0'); -- id=2015
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 = 940;
 INSERT INTO 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-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-97.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-97.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '707', userid = '1', storedetaildate = '2026-09-27 12:49:09' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '15', '0', '134', 'تعديل فاتورة مبيعات', 'sellbillController.php', '692', '707', '1', '2026-09-26 16:55:00','0','0'); -- id=2016
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 941;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '872', userid = '1', storedetaildate = '2026-09-27 12:49:09' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '134', 'تعديل فاتورة مبيعات', 'sellbillController.php', '857', '872', '1', '2026-09-26 16:55:00','0','0'); -- id=2017
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '731.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','7621.10','6890.00','1','تعديل فاتورة مبيعات','134', '731.1', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '6890', '0', null, '0', null, null,'', '0','1','1','6890','1','2026-09-26 16:55:00','0','0','',''); -- id=239
UPDATE client SET  inUse = 0 where clientid = 5;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-27', 6890, 5838.3, 5838.3
                    , 5838.3, 5838.3, 5838.3, 5838.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5838.3, 5838.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6890, sellCostBuyPrice =sellCostBuyPrice-5838.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5838.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5838.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5838.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5838.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5838.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5838.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5838.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-27', 6890, 5838.3, 5838.3
                    , 5838.3, 5838.3, 5838.3, 5838.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5838.3, 5838.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6890, sellCostBuyPrice =sellCostBuyPrice-5838.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5838.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5838.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5838.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5838.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5838.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5838.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5838.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 6890, 5838.3, 5838.3
                    , 5838.3, 5838.3, 5838.3, 5838.3, 5838.3, 5838.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-6890, netSellCostBuyPrice = netSellCostBuyPrice-5838.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-5838.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-5838.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-5838.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-5838.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-5838.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-5838.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-5838.3;

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


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

COMMIT;
BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:55:00', '06ab7da708e886', '5', '731.10', '10041.1', '0', '1', '9310', '9310', '0', '9310', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '37', '134', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=142
UPDATE client SET  clientdebt = '10041.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','731.10','9310','0','اضافة فاتورة مبيعات (معدله)','142', '10041.1', '2026-09-27 12:49:10', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '9310', '0', null, '0', null, null,'', '0','1','1','6890','1','2026-09-26 16:55:00','0','0','',''); -- id=240
UPDATE client SET  inUse = 0 where clientid = 5;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '142', '10', '208', '7', '1210', '8470', '0', '', '1', '2026-09-27 12:49:10', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','8470','0','','0','0.00','0','0','0','0'); -- id=981
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 = 981;
 INSERT INTO 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-27', 8470, 7140, 7140
                    , 7140, 7140, 7140, 7140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 7140, 7140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8470, sellCostBuyPrice =sellCostBuyPrice+7140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 8470, 7140, 7140
                    , 7140, 7140, 7140, 7140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7140, 7140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8470, sellCostBuyPrice =sellCostBuyPrice+7140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-09-27 12:49:10' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '7', '1', '142', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '48', '41', '1', '2026-09-27 12:49:10','0','0'); -- id=2018
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '142', '6', '315', '15.00', '8', '120', '0', '', '1', '2026-09-27 12:49:10', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','120','0','','0','0.00','0','0','0','0'); -- id=982
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 = 982;
 INSERT INTO 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-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+97.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+97.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '692', userid = '1', storedetaildate = '2026-09-27 12:49:10' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '15', '1', '142', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '707', '692', '1', '2026-09-27 12:49:10','0','0'); -- id=2019
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.72','00182', '142', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-09-27 12:49:10', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','720','0','','0','0.00','0','0','0','0'); -- id=983
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 983;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '857', userid = '1', storedetaildate = '2026-09-27 12:49:10' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '142', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '872', '857', '1', '2026-09-27 12:49:10','0','0'); -- id=2020
UPDATE dailyentry SET totalcreditor = '6890.00', totaldebtor = '6890.00', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 16:55:02', entryComment = 'اضافة فاتورة مبيعات رقم 134', fromFlag = '1',related='0',isopeningentry='0',operationId='134',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=134' WHERE id = '966';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6890.00', '6890.00', '2026-09-27', '1', '0', '966', '2026-09-27 12:49:10','تم عكس القيد رقم 966 ','1','0','0','0','0',''); -- id=996
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('996', '430', '6890.00', '','0'); -- id=996
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '731.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('996', '143', '6890.00', '','0'); -- id=996
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '458905.52', 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 = '5838.30', totaldebtor = '5838.30', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 16:55:02', entryComment = 'اضافة فاتورة مبيعات رقم 134 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='134',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=134' WHERE id = '967';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5838.30', '5838.30', '2026-09-27', '1', '0', '967', '2026-09-27 12:49:11','تم عكس القيد رقم 967 ','1','0','0','0','0',''); -- id=997
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('997', '402', '5838.30', '','0'); -- id=997
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '426312.18', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('997', '382', '5838.30', '','0'); -- id=997
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2415891.29', 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 ( '9310', '9310', '2026-09-27', '1', '0', '0', '2026-09-27 12:49:11','اضافة فاتورة مبيعات رقم 142','1','0',null,'0','142','sellbillController.php?do=showDetail&sellbillid=142'); -- id=998
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('998', '430', '9310', '','0'); -- id=998
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '10041.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('998', '143', '9310', '','0'); -- id=998
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '468215.52', 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 ( '7878.3', '7878.3', '2026-09-27', '1', '0', '0', '2026-09-27 12:49:11','اضافة فاتورة مبيعات رقم 142 - صرف البضاعة من المخزن','1','0',null,'0','142','sellbillController.php?do=showDetail&sellbillid=142'); -- id=999
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('999', '402', '7878.3', '','0'); -- id=999
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '434190.48', 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 ('999', '382', '7878.3', '','0'); -- id=999
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2408012.99', 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='998,0,999' where sellbillid=142;
 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-27', 9310, 7878.3, 7878.3
                    , 7878.3, 7878.3, 7878.3, 7878.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7878.3, 7878.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9310, sellCostBuyPrice =sellCostBuyPrice+7878.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7878.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7878.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7878.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7878.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7878.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7878.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7878.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-27', 9310, 7878.3, 7878.3
                    , 7878.3, 7878.3, 7878.3, 7878.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7878.3, 7878.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9310, sellCostBuyPrice =sellCostBuyPrice+7878.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7878.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7878.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7878.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7878.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7878.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7878.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7878.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 9310, 7878.3, 7878.3
                    , 7878.3, 7878.3, 7878.3, 7878.3, 7878.3, 7878.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9310, netSellCostBuyPrice = netSellCostBuyPrice+7878.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7878.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7878.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7878.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7878.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7878.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7878.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7878.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 134 and newid=142 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:19:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 12:49:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 12:49:12', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=142'); -- id=2563
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:51:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:21:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 13:21:59', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2564
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','960','985','1050','985','2026-09-27','0','1','1','','0','0','0','0','0','960','960','960','960','960','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','960','960','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=522
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (522, 1,'2026-09-27 13:23:43',1)
                ON DUPLICATE KEY UPDATE productid = 522, edited = 1, sysdate = '2026-09-27 13:23:43', userid = 1; -- id=649
UPDATE product SET productName = 'لوحه اتصالات جامبو استار ترانز ', productDescription = '', productCatId = '6', productBuyPrice = '960', productSellAllPrice = '985', productSellUnitPrice = '1050', productSellHalfPrice = '985', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '1', parcode = '00522',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '960',lastbuyprice_withDiscount = '960',meanbuyprice = '960',meanbuyprice_withDiscount = '960' , productbuypricereal = '960' , 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='960',meanbuyprice_withTax='960',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 = '522';
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', '522', '1', '2026-09-27', '1', '0','0052201','985','985','1050','960','','0','0','0','0','0','0','0','0','0','0'); -- id=522
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('522', '1', '0', '1', '2026-09-27'); -- id=522
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('522', '1', '0', '0', '522', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-09-27','0','0'); -- id=2021
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 ('لوحه 18 خط بالعمومي جامبو استار ترانز ','','6','966','995','1090','995','2026-09-27','0','1','1','','0','0','0','0','0','966','966','966','966','966','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','966','966','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=523
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (523, 1,'2026-09-27 13:24:44',1)
                ON DUPLICATE KEY UPDATE productid = 523, edited = 1, sysdate = '2026-09-27 13:24:44', userid = 1; -- id=650
UPDATE product SET productName = 'لوحه 18 خط بالعمومي جامبو استار ترانز ', productDescription = '', productCatId = '6', productBuyPrice = '966', productSellAllPrice = '995', productSellUnitPrice = '1090', productSellHalfPrice = '995', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '1', parcode = '00523',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '966',lastbuyprice_withDiscount = '966',meanbuyprice = '966',meanbuyprice_withDiscount = '966' , productbuypricereal = '966' , 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='966',meanbuyprice_withTax='966',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 = '523';
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', '523', '1', '2026-09-27', '1', '0','0052301','995','995','1090','966','','0','0','0','0','0','0','0','0','0','0'); -- id=523
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('523', '1', '0', '1', '2026-09-27'); -- id=523
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('523', '1', '0', '0', '523', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-09-27','0','0'); -- id=2022
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 ('لوحه 24 خط بالعمومي استار ترانز','','6','1068.75','1150','1250','1150','2026-09-27','0','1','1','','0','0','0','0','0','1068.75','1068.75','1068.75','1068.75','1068.75','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','1068.75','1068.75','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=524
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (524, 1,'2026-09-27 13:25:25',1)
                ON DUPLICATE KEY UPDATE productid = 524, edited = 1, sysdate = '2026-09-27 13:25:25', userid = 1; -- id=651
UPDATE product SET productName = 'لوحه 24 خط بالعمومي استار ترانز', productDescription = '', productCatId = '6', productBuyPrice = '1068.75', productSellAllPrice = '1150', productSellUnitPrice = '1250', productSellHalfPrice = '1150', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '1', parcode = '00524',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1068.75',lastbuyprice_withDiscount = '1068.75',meanbuyprice = '1068.75',meanbuyprice_withDiscount = '1068.75' , productbuypricereal = '1068.75' , 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='1068.75',meanbuyprice_withTax='1068.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='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 = '524';
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', '524', '1', '2026-09-27', '1', '0','0052401','1150','1150','1250','1068.75','','0','0','0','0','0','0','0','0','0','0'); -- id=524
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('524', '1', '0', '1', '2026-09-27'); -- id=524
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('524', '1', '0', '0', '524', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-09-27','0','0'); -- id=2023
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:55:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:25:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 13:25:45', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2565
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 ('06ab8fc582b050', '2026-09-27 13:22:00', '1', '42113.50', '42113.5', '0', '0', '34747.50',  '34747.50', '34747.5', '0', '1', '2026-09-27 13:25:46', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=29
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 ('00522', '29', '6', '522', '15', '960', '14400.00', '0', '', '2026-09-27 13:25:46', '522','','','0','0','0','0','0',null,'960','14400','0','0','0','0','0','0','0','0','1'); -- id=105
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 13:22:00', 1, 522, 0, 0
                    , 960, 15, 0, 0, 1, '2026-09-27 13:25:46')
                ON DUPLICATE KEY UPDATE buyprice = 960,
                        buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 13:25:46' ; -- id=105
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('522', '960', '15', '0', 'buyBillController.php', '105', '', '0', '0'); -- id=105
UPDATE product SET  productBuyPrice = "960" WHERE productId = 522 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 105 ;
UPDATE product SET productName = 'لوحه اتصالات جامبو استار ترانز ', productDescription = '', productCatId = '6', productBuyPrice = '960.00', productSellAllPrice = '985.00', productSellUnitPrice = '1050.00', productSellHalfPrice = '985.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '1', parcode = '00522',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '960',lastbuyprice_withDiscount = '960',meanbuyprice = '960',meanbuyprice_withDiscount = '960' , productbuypricereal = '960.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='960',meanbuyprice_withTax='960',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='960',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '522';
UPDATE buybilldetail SET  lastbuyprice = 960 , meanbuyprice = 960, lastbuyprice_withDiscount = 960, meanbuyprice_withDiscount = 960
        , lastbuyprice_withTax = 960, meanbuyprice_withTax = 960, lastbuyprice_withDiscountAndTax = 960
                where buybilldetailid = 105;
UPDATE productunit SET proUnitBuyPrice  = 960 * productnumber WHERE productid = 522;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '522';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('522', '1', '15', '0', '29', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '15', '1', '2026-09-27 13:22:00','0','0'); -- id=2024
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 ('00523', '29', '6', '523', '10', '966', '9660.00', '0', '', '2026-09-27 13:25:46', '523','','','0','0','0','0','0',null,'966','9660','0','0','0','0','0','0','0','0','1'); -- id=106
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 13:22:00', 1, 523, 0, 0
                    , 966, 10, 0, 0, 1, '2026-09-27 13:25:46')
                ON DUPLICATE KEY UPDATE buyprice = 966,
                        buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 13:25:46' ; -- id=106
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('523', '966', '10', '0', 'buyBillController.php', '106', '', '0', '0'); -- id=106
UPDATE product SET  productBuyPrice = "966" WHERE productId = 523 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 106 ;
UPDATE product SET productName = 'لوحه 18 خط بالعمومي جامبو استار ترانز ', productDescription = '', productCatId = '6', productBuyPrice = '966.00', productSellAllPrice = '995.00', productSellUnitPrice = '1090.00', productSellHalfPrice = '995.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '1', parcode = '00523',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '966',lastbuyprice_withDiscount = '966',meanbuyprice = '966',meanbuyprice_withDiscount = '966' , productbuypricereal = '966.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='966',meanbuyprice_withTax='966',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='966',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '523';
UPDATE buybilldetail SET  lastbuyprice = 966 , meanbuyprice = 966, lastbuyprice_withDiscount = 966, meanbuyprice_withDiscount = 966
        , lastbuyprice_withTax = 966, meanbuyprice_withTax = 966, lastbuyprice_withDiscountAndTax = 966
                where buybilldetailid = 106;
UPDATE productunit SET proUnitBuyPrice  = 966 * productnumber WHERE productid = 523;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '523';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('523', '1', '10', '0', '29', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '10', '1', '2026-09-27 13:22:00','0','0'); -- id=2025
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 ('00524', '29', '6', '524', '10', '1068.75', '10687.50', '0', '', '2026-09-27 13:25:46', '524','','','0','0','0','0','0',null,'1068.75','10687.5','0','0','0','0','0','0','0','0','1'); -- id=107
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 13:22:00', 1, 524, 0, 0
                    , 1068.75, 10, 0, 0, 1, '2026-09-27 13:25:47')
                ON DUPLICATE KEY UPDATE buyprice = 1068.75,
                        buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 13:25:47' ; -- id=107
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('524', '1068.75', '10', '0', 'buyBillController.php', '107', '', '0', '0'); -- id=107
UPDATE product SET  productBuyPrice = "1068.75" WHERE productId = 524 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 107 ;
UPDATE product SET productName = 'لوحه 24 خط بالعمومي استار ترانز', productDescription = '', productCatId = '6', productBuyPrice = '1068.75', productSellAllPrice = '1150.00', productSellUnitPrice = '1250.00', productSellHalfPrice = '1150.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '1', parcode = '00524',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1068.75',lastbuyprice_withDiscount = '1068.75',meanbuyprice = '1068.75',meanbuyprice_withDiscount = '1068.75' , productbuypricereal = '1068.75' , 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='1068.75',meanbuyprice_withTax='1068.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='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='1068.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 = '524';
UPDATE buybilldetail SET  lastbuyprice = 1068.75 , meanbuyprice = 1068.75, lastbuyprice_withDiscount = 1068.75, meanbuyprice_withDiscount = 1068.75
        , lastbuyprice_withTax = 1068.75, meanbuyprice_withTax = 1068.75, lastbuyprice_withDiscountAndTax = 1068.75
                where buybilldetailid = 107;
UPDATE productunit SET proUnitBuyPrice  = 1068.75 * productnumber WHERE productid = 524;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('524', '1', '10', '0', '29', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '10', '1', '2026-09-27 13:22:00','0','0'); -- id=2026
UPDATE supplier SET  suppliercurrentDebt = '42113.5',suppliercurrentDebtInCurrency= '42113.5' , userid = '1', supplierdate = '2026-09-27 13:25:46'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '42113.50', '0', '0', 'اضافة فاتورة مشتريات', '29', '42113.5', '2026-09-27 13:22:00', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','42113.5','0','42113.5','0',''); -- id=55
UPDATE save SET  savecurrentvalue = '-397776.78',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-363029.28','34747.5', '1', '1', 'اضافة فاتورة مشتريات', '29', '-397776.78', '2026-09-27 13:22:00', '1',  'buyBillController.php','0','','0'); -- id=152
update buybill set dailyentryid='0,0' where buybillid=29;
COMMIT;
UPDATE product SET overAllAveragePrice = 960 WHERE productId = 522;UPDATE product SET overAllAveragePrice = 966 WHERE productId = 523;UPDATE product SET overAllAveragePrice = 1068.75 WHERE productId = 524;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:55:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:25:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 13:25:48', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=29'); -- id=2566
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:55:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:25:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-27 13:25:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2567
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:56:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:26:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-27 13:26:02', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=2568
UPDATE product SET productName = 'لوحه 24 خط بالعمومي جامبو استار ترانز', productDescription = '', productCatId = '6', productBuyPrice = '1068.75', productSellAllPrice = '1150.00', productSellUnitPrice = '1250.00', productSellHalfPrice = '1150.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '1', parcode = '00524',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1068.75',lastbuyprice_withDiscount = '1068.75',meanbuyprice = '1068.75',meanbuyprice_withDiscount = '1068.75' , productbuypricereal = '1068.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1068.75',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='1068.75',meanbuyprice_withTax='1068.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='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='1068.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 = '524';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (524, 1,'2026-09-27 13:26:13',1)
                ON DUPLICATE KEY UPDATE productid = 524, edited = 1, sysdate = '2026-09-27 13:26:13', userid = 1; -- id=651
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:56:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:26:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-09-27 13:26:32', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierController.php?do=show'); -- id=2569
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:56:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:26:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-27 13:26:52', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=2570
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-27 09:56:53";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-27 13:26:53', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=2571
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:57:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:27:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-09-27 13:27:26', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php'); -- id=2572
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:57:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:27:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-09-27 13:27:35', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/storedetailController.php?do=show'); -- id=2573
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:58:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:28:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 13:28:06', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2574
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:58:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:28:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 13:28:25', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2575
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:58:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:28:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 13:28:45', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=2576

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =241
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(4,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-346.32' , clientdate = '2026-09-27 13:28:45', userid = '1' WHERE clientid = '4';
UPDATE client SET  inUse = 0 where clientid = 4;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('4','4153.68','4500','1','ايصال تحصيل (( قبض من عميل ))','241', '-346.32', '2026-09-27 13:28:25', '1', 'clientPayedDeptController.php', '   ', '4500', '0', null, '0', null, null,'', '-1','1','1','4500','1','','20','0','','.'); -- id=241
UPDATE save SET  savecurrentvalue = '-393276.78',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-397776.78','4500', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '241', '-393276.78', '2026-09-27 13:28:46', '1',  'clientPayedDeptController.php','4','','0'); -- id=153
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4500', '4500', '2026-09-27', '1', '0', '0', '2026-09-27 13:28:46','اضافة ايصال سداد للعميل محمد عبدالله الالفي','1','0','0','0','241','clientPayedDeptController.php?do=show&id=241'); -- id=1000
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1000', '383', '4500', '','0'); -- id=1000
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-233195.24', 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 ('1000', '428', '4500', '','0'); -- id=1000
UPDATE accountstree SET name = 'محمد عبدالله الالفي', customName = 'محمد عبدالله الالفي', customNameEn = 'محمد عبدالله الالفي', nameEn = 'محمد عبدالله الالفي', parent = '58', accountNature = '0', theValue = '-346.32', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 09:05:36' WHERE id = '428';
UPDATE clientdebtchange SET clientid = '4', clientdebtchangebefore = '4153.680', clientdebtchangeamount = '4500.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '241', clientdebtchangeafter = '-346.320', clientdebtchangedate = '2026-09-27 13:28:25', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '4500.000',discount='', reciptid='0', dailyentryid = '1000',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='4500',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '241';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:58:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:28:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 13:28:47', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=2577
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:58:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:28:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 13:28:48', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=2578
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:58:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:28:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 13:28:51', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2579
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 09:58:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 13:29:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 13:29:00', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2580
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:17:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:47:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:47:41', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2581
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:17:50";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:47:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:47:50', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2582
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:17:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:47:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:47:56', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=142'); -- id=2583
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:18:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:48:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:48:41', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2584
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 142;
UPDATE sellbill SET  sellbillsysdate = '2026-09-27 14:48:41', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '142';
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 = 981;
 INSERT INTO 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-27', 8470, 7140, 7140
                    , 7140, 7140, 7140, 7140
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 7140, 7140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8470, sellCostBuyPrice =sellCostBuyPrice-7140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7140, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7140
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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-27', 8470, 7140, 7140
                    , 7140, 7140, 7140, 7140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7140, 7140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-8470, sellCostBuyPrice =sellCostBuyPrice-7140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7140, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7140
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-09-27 14:48:42' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '7', '0', '142', 'تعديل فاتورة مبيعات', 'sellbillController.php', '41', '48', '1', '2026-09-26 16:55:00','0','0'); -- id=2027
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 = 982;
 INSERT INTO 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-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-97.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-97.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '707', userid = '1', storedetaildate = '2026-09-27 14:48:42' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '15', '0', '142', 'تعديل فاتورة مبيعات', 'sellbillController.php', '692', '707', '1', '2026-09-26 16:55:00','0','0'); -- id=2028
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 983;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,15,0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-15
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-720, sellCostBuyPrice =sellCostBuyPrice-640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-640.8
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '872', userid = '1', storedetaildate = '2026-09-27 14:48:42' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '0', '142', 'تعديل فاتورة مبيعات', 'sellbillController.php', '857', '872', '1', '2026-09-26 16:55:00','0','0'); -- id=2029
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '731.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','10041.10','9310.00','1','تعديل فاتورة مبيعات','142', '731.1', '2026-09-26 16:55:00', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '9310', '0', null, '0', null, null,'', '0','1','1','9310','1','2026-09-26 16:55:00','0','0','',''); -- id=242
UPDATE client SET  inUse = 0 where clientid = 5;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-09-27', 9310, 7878.3, 7878.3
                    , 7878.3, 7878.3, 7878.3, 7878.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7878.3, 7878.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9310, sellCostBuyPrice =sellCostBuyPrice-7878.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7878.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7878.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7878.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7878.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7878.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7878.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7878.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-27', 9310, 7878.3, 7878.3
                    , 7878.3, 7878.3, 7878.3, 7878.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7878.3, 7878.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9310, sellCostBuyPrice =sellCostBuyPrice-7878.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-7878.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice-7878.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-7878.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-7878.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-7878.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-7878.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-7878.3
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 9310, 7878.3, 7878.3
                    , 7878.3, 7878.3, 7878.3, 7878.3, 7878.3, 7878.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-9310, netSellCostBuyPrice = netSellCostBuyPrice-7878.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-7878.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-7878.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-7878.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-7878.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-7878.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-7878.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-7878.3;

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


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

COMMIT;
BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 16:55:00', '06ab7da708e886', '5', '731.10', '10506.1', '0', '1', '9775', '9775', '0', '9775', '1', '2026-09-26 16:55:00', '', '1', '0', 'احمد عبدالحميد حسون ', '1', '1', '3', '0', 'احمد عبدالحميد حسون ', '40', '142', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=143
UPDATE client SET  clientdebt = '10506.1', userid = '1' WHERE clientid = '5';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','731.10','9775','0','اضافة فاتورة مبيعات (معدله)','143', '10506.1', '2026-09-27 14:48:42', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '9775', '0', null, '0', null, null,'', '0','1','1','9310','1','2026-09-26 16:55:00','0','0','',''); -- id=243
UPDATE client SET  inUse = 0 where clientid = 5;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1020','00208', '143', '10', '208', '7.00', '1210', '8470', '0', '', '1', '2026-09-27 14:48:43', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1210','8470','0','','0','0.00','0','0','0','0'); -- id=984
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 = 984;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (208, '2026-09-27', 8470, 7140, 7140
                    , 7140, 7140, 7140, 7140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 7140, 7140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8470, sellCostBuyPrice =sellCostBuyPrice+7140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 8470, 7140, 7140
                    , 7140, 7140, 7140, 7140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7140, 7140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8470, sellCostBuyPrice =sellCostBuyPrice+7140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-09-27 14:48:43' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '7', '1', '143', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '48', '41', '1', '2026-09-27 14:48:43','0','0'); -- id=2030
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '143', '6', '315', '15.00', '8', '120', '0', '', '1', '2026-09-27 14:48:43', '315', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','8','120','0','','0','0.00','0','0','0','0'); -- id=985
UPDATE sellbilldetail SET  lastbuyprice = 6.50 , meanbuyprice = 6.50, lastbuyprice_withDiscount = 6.50, meanbuyprice_withDiscount = 6.50
        , lastbuyprice_withTax = 6.5, meanbuyprice_withTax = 6.5, lastbuyprice_withDiscountAndTax = 6.5
                where sellbilldetailid = 985;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (315, '2026-09-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+97.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 120, 97.5, 97.5
                    , 97.5, 97.5, 97.5, 97.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 97.5, 97.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+97.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+97.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+97.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+97.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+97.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+97.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+97.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+97.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '692', userid = '1', storedetaildate = '2026-09-27 14:48:43' WHERE storedetailid = '315';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('315', '1', '15', '1', '143', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '707', '692', '1', '2026-09-27 14:48:43','0','0'); -- id=2031
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('42.72','00182', '143', '20', '182', '15.00', '48', '720', '0', '', '1', '2026-09-27 14:48:43', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','720','0','','0','0.00','0','0','0','0'); -- id=986
UPDATE sellbilldetail SET  lastbuyprice = 42.72 , meanbuyprice = 42.72, lastbuyprice_withDiscount = 42.72, meanbuyprice_withDiscount = 42.72
        , lastbuyprice_withTax = 42.72, meanbuyprice_withTax = 42.72, lastbuyprice_withDiscountAndTax = 42.72
                where sellbilldetailid = 986;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 720, 640.8, 640.8
                    , 640.8, 640.8, 640.8, 640.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 640.8, 640.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+640.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+640.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+640.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+640.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+640.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+640.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+640.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+640.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '857', userid = '1', storedetaildate = '2026-09-27 14:48:43' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '15', '1', '143', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '872', '857', '1', '2026-09-27 14:48:43','0','0'); -- id=2032
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('157.92','00186', '143', '20', '186', '1', '165', '165', '0', '', '1', '2026-09-27 14:48:43', '186', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','165','165','0','','0','0.00','0','0','0','0'); -- id=987
UPDATE sellbilldetail SET  lastbuyprice = 157.92 , meanbuyprice = 157.92, lastbuyprice_withDiscount = 157.92, meanbuyprice_withDiscount = 157.92
        , lastbuyprice_withTax = 157.92, meanbuyprice_withTax = 157.92, lastbuyprice_withDiscountAndTax = 157.92
                where sellbilldetailid = 987;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (186, '2026-09-27', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 165, 157.92, 157.92
                    , 157.92, 157.92, 157.92, 157.92
                    , 0, 0, 0, 0
                    , 0, 0, 0, 157.92, 157.92, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+157.92
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+157.92, sellCostMeanBuyPrice = sellCostMeanBuyPrice+157.92
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+157.92, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+157.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+157.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+157.92
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+157.92
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '1', storedetaildate = '2026-09-27 14:48:43' WHERE storedetailid = '186';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('186', '1', '1', '1', '143', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '124', '123', '1', '2026-09-27 14:48:43','0','0'); -- id=2033
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('139.2','00185', '143', '20', '185', '2', '150', '300', '0', '', '1', '2026-09-27 14:48:43', '185', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','150','300','0','','0','0.00','0','0','0','0'); -- id=988
UPDATE sellbilldetail SET  lastbuyprice = 139.20 , meanbuyprice = 139.20, lastbuyprice_withDiscount = 139.20, meanbuyprice_withDiscount = 139.20
        , lastbuyprice_withTax = 139.2, meanbuyprice_withTax = 139.2, lastbuyprice_withDiscountAndTax = 139.2
                where sellbilldetailid = 988;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (185, '2026-09-27', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 300, 278.4, 278.4
                    , 278.4, 278.4, 278.4, 278.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 278.4, 278.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+278.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+278.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+278.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+278.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+278.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+278.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+278.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+278.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '221', userid = '1', storedetaildate = '2026-09-27 14:48:44' WHERE storedetailid = '185';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('185', '1', '2', '1', '143', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '223', '221', '1', '2026-09-27 14:48:44','0','0'); -- id=2034
UPDATE dailyentry SET totalcreditor = '9310.00', totaldebtor = '9310.00', thedate = '2026-09-27', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-27 12:49:11', entryComment = 'اضافة فاتورة مبيعات رقم 142', fromFlag = '1',related='0',isopeningentry='0',operationId='142',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=142' WHERE id = '998';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9310.00', '9310.00', '2026-09-27', '1', '0', '998', '2026-09-27 14:48:44','تم عكس القيد رقم 998 ','1','0','0','0','0',''); -- id=1001
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1001', '430', '9310.00', '','0'); -- id=1001
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '731.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1001', '143', '9310.00', '','0'); -- id=1001
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '458905.52', 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 = '7878.30', totaldebtor = '7878.30', thedate = '2026-09-27', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-27 12:49:11', entryComment = 'اضافة فاتورة مبيعات رقم 142 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='142',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=142' WHERE id = '999';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7878.30', '7878.30', '2026-09-27', '1', '0', '999', '2026-09-27 14:48:44','تم عكس القيد رقم 999 ','1','0','0','0','0',''); -- id=1002
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1002', '402', '7878.30', '','0'); -- id=1002
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '426312.18', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1002', '382', '7878.30', '','0'); -- id=1002
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2415891.29', 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 ( '9775', '9775', '2026-09-27', '1', '0', '0', '2026-09-27 14:48:44','اضافة فاتورة مبيعات رقم 143','1','0',null,'0','143','sellbillController.php?do=showDetail&sellbillid=143'); -- id=1003
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1003', '430', '9775', '','0'); -- id=1003
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '10506.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1003', '143', '9775', '','0'); -- id=1003
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '468680.52', 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 ( '8314.62', '8314.62', '2026-09-27', '1', '0', '0', '2026-09-27 14:48:44','اضافة فاتورة مبيعات رقم 143 - صرف البضاعة من المخزن','1','0',null,'0','143','sellbillController.php?do=showDetail&sellbillid=143'); -- id=1004
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1004', '402', '8314.62', '','0'); -- id=1004
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '434626.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 ('1004', '382', '8314.62', '','0'); -- id=1004
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2407576.67', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1003,0,1004' where sellbillid=143;
 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-27', 9775, 8314.62, 8314.62
                    , 8314.62, 8314.62, 8314.62, 8314.62
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8314.62, 8314.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9775, sellCostBuyPrice =sellCostBuyPrice+8314.62
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8314.62, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8314.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8314.62, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8314.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8314.62
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8314.62
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8314.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-09-27', 9775, 8314.62, 8314.62
                    , 8314.62, 8314.62, 8314.62, 8314.62
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8314.62, 8314.62, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9775, sellCostBuyPrice =sellCostBuyPrice+8314.62
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8314.62, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8314.62
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8314.62, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8314.62
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8314.62
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8314.62
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8314.62
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 9775, 8314.62, 8314.62
                    , 8314.62, 8314.62, 8314.62, 8314.62, 8314.62, 8314.62)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9775, netSellCostBuyPrice = netSellCostBuyPrice+8314.62
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8314.62
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8314.62
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8314.62
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8314.62
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8314.62
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8314.62
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8314.62;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:18:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:48:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:48:45', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=143'); -- id=2585
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:18:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:48:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:48:54', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2586
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:19:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:49:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:49:02', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2587
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:19:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:49:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:49:07', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=143'); -- id=2588
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:19:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:49:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 14:49:15', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2589
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:19:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:49:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 14:49:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2590
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:19:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:49:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:49:26', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=143'); -- id=2591
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:19:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 14:49:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 14:49:38', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2592
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:39:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 15:09:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 15:09:30', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2593
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:39:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 15:09:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 15:09:36', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=2594
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:39:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 15:09:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 15:09:41', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=127'); -- id=2595
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:43:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 15:13:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 15:13:39', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=2596
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 127;
UPDATE sellbill SET  sellbillsysdate = '2026-09-27 15:13:40', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '127';
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 = 916;
 INSERT INTO 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-27', 3720, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3720, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 3720, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3720, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '44', userid = '1', storedetaildate = '2026-09-27 15:13:40' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '3', '0', '127', 'تعديل فاتورة مبيعات', 'sellbillController.php', '41', '44', '1', '2026-09-26 11:00:35','0','0'); -- id=2035
CALL clientInUse(36,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '11000', userid = '1' WHERE clientid = '36';
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 ('36','14720.00','3720.00','1','تعديل فاتورة مبيعات','127', '11000', '2026-09-26 11:00:35', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '3720', '0', null, '0', null, null,'', '0','1','1','3720','1','2026-09-26 11:00:35','0','0','',''); -- id=244
UPDATE client SET  inUse = 0 where clientid = 36;
 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-27', 3720, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3720, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (36, '2026-09-27', 3720, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3720, sellCostBuyPrice =sellCostBuyPrice-3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3060
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3720, 3060, 3060
                    , 3060, 3060, 3060, 3060, 3060, 3060)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-3720, netSellCostBuyPrice = netSellCostBuyPrice-3060
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-3060
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-3060
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-3060
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-3060
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-3060
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-3060
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-3060;

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


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

COMMIT;
BEGIN;
CALL clientInUse(36,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-09-26 11:00:35', '06ab778021d33e', '36', '11000.00', '15960', '0', '1', '4960', '4960', '0', '4960', '1', '2026-09-26 11:00:35', '', '1', '0', 'ابراهيم سرور ', '1', '1', '3', '0', '36 - ابراهيم سرور ', '4', '127', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-09-26','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=144
UPDATE client SET  clientdebt = '15960', userid = '1' WHERE clientid = '36';
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 ('36','11000.00','4960','0','اضافة فاتورة مبيعات (معدله)','144', '15960', '2026-09-27 15:13:40', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '4960', '0', null, '0', null, null,'', '0','1','1','3720','1','2026-09-26 11:00:35','0','0','',''); -- id=245
UPDATE client SET  inUse = 0 where clientid = 36;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '144', '10', '208', '4', '1240', '4960', '0', '', '1', '2026-09-27 15:13:41', '208', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1240','4960','0','','0','0.00','0','0','0','0'); -- id=989
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 = 989;
 INSERT INTO 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-27', 4960, 4080, 4080
                    , 4080, 4080, 4080, 4080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4960, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 4960, 4080, 4080
                    , 4080, 4080, 4080, 4080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4960, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 15:13:41' WHERE storedetailid = '208';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('208', '1', '4', '1', '144', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '44', '40', '1', '2026-09-27 15:13:41','0','0'); -- id=2036
UPDATE dailyentry SET totalcreditor = '3720.00', totaldebtor = '3720.00', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 11:00:36', entryComment = 'اضافة فاتورة مبيعات رقم 127', fromFlag = '1',related='0',isopeningentry='0',operationId='127',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=127' WHERE id = '946';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3720.00', '3720.00', '2026-09-27', '1', '0', '946', '2026-09-27 15:13:41','تم عكس القيد رقم 946 ','1','0','0','0','0',''); -- id=1005
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1005', '468', '3720.00', '','0'); -- id=1005
UPDATE accountstree SET name = 'ابراهيم سرور ', customName = 'ابراهيم سرور ', customNameEn = 'ابراهيم سرور ', nameEn = 'ابراهيم سرور ', parent = '58', accountNature = '0', theValue = '11000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-23 22:00:56' WHERE id = '468';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1005', '143', '3720.00', '','0'); -- id=1005
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '464960.52', 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 = '3060.00', totaldebtor = '3060.00', thedate = '2026-09-26', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-09-26 11:00:36', entryComment = 'اضافة فاتورة مبيعات رقم 127 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='127',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=127' WHERE id = '947';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3060.00', '3060.00', '2026-09-27', '1', '0', '947', '2026-09-27 15:13:41','تم عكس القيد رقم 947 ','1','0','0','0','0',''); -- id=1006
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1006', '402', '3060.00', '','0'); -- id=1006
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '431566.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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1006', '382', '3060.00', '','0'); -- id=1006
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2410636.67', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4960', '4960', '2026-09-27', '1', '0', '0', '2026-09-27 15:13:42','اضافة فاتورة مبيعات رقم 144','1','0',null,'0','144','sellbillController.php?do=showDetail&sellbillid=144'); -- id=1007
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1007', '468', '4960', '','0'); -- id=1007
UPDATE accountstree SET name = 'ابراهيم سرور ', customName = 'ابراهيم سرور ', customNameEn = 'ابراهيم سرور ', nameEn = 'ابراهيم سرور ', parent = '58', accountNature = '0', theValue = '15960', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-23 22:00:56' WHERE id = '468';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1007', '143', '4960', '','0'); -- id=1007
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '469920.52', 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 ( '4080', '4080', '2026-09-27', '1', '0', '0', '2026-09-27 15:13:42','اضافة فاتورة مبيعات رقم 144 - صرف البضاعة من المخزن','1','0',null,'0','144','sellbillController.php?do=showDetail&sellbillid=144'); -- id=1008
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1008', '402', '4080', '','0'); -- id=1008
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '435646.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 ('1008', '382', '4080', '','0'); -- id=1008
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2406556.67', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1007,0,1008' where sellbillid=144;
 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-27', 4960, 4080, 4080
                    , 4080, 4080, 4080, 4080
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4960, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, 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 (36, '2026-09-27', 4960, 4080, 4080
                    , 4080, 4080, 4080, 4080
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4960, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, 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, 4960, 4080, 4080
                    , 4080, 4080, 4080, 4080, 4080, 4080)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4960, netSellCostBuyPrice = netSellCostBuyPrice+4080
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4080
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4080
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4080
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4080
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4080
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4080
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4080;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 127 and newid=144 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:43:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 15:13:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 15:13:43', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=144'); -- id=2597
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 11:46:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 15:16:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 15:16:30', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2598
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 12:48:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 16:18:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 16:18:45', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2599

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab9172f40e37
-- ----------------------------------------------------------------------------------------------------

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-27 16:19:00', '06ab9172f40e37', '1', '0.00', '0', '0', '1', '191.85', '191.85', '191.85', '0', '1', '2026-09-27 16:19:00', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '13.1' ,'0','','','','','-1','0','0','0','0','0','191','0','','0','0','191.85','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-27','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=145
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','اضافة فاتورة مبيعات','145', '0', '2026-09-27 16:19:00', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '191.85', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-27 16:19:00','0','0','',''); -- id=246
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 97;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '145', '3', '101', '2', '17.75', '35.5', '0', '', '1', '2026-09-27 16:19:01', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','97-2,','1','1','0','0','17.75','35.5','0','','0','0.00','0','0','0','0'); -- id=990
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 = 990;
 INSERT INTO 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-27', 35.5, 35.2, 35.2
                    , 35.2, 35.2, 35.2, 35.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 35.2, 35.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+35.5, sellCostBuyPrice =sellCostBuyPrice+35.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 35.5, 35.2, 35.2
                    , 35.2, 35.2, 35.2, 35.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35.2, 35.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+35.5, sellCostBuyPrice =sellCostBuyPrice+35.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '666', userid = '1', storedetaildate = '2026-09-27 16:19:01' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '2', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '668', '666', '1', '2026-09-27 16:19:01','0','0'); -- id=2037
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 96;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '145', '3', '100', '3', '17.75', '53.25', '0', '', '1', '2026-09-27 16:19:01', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','96-3,','1','1','0','0','17.75','53.25','0','','0','0.00','0','0','0','0'); -- id=991
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 = 991;
 INSERT INTO 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-27', 53.25, 52.8, 52.8
                    , 52.8, 52.8, 52.8, 52.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 52.8, 52.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+53.25, sellCostBuyPrice =sellCostBuyPrice+52.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52.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+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-27', 53.25, 52.8, 52.8
                    , 52.8, 52.8, 52.8, 52.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52.8, 52.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+53.25, sellCostBuyPrice =sellCostBuyPrice+52.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52.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 = '622', userid = '1', storedetaildate = '2026-09-27 16:19:01' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '3', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '625', '622', '1', '2026-09-27 16:19:01','0','0'); -- id=2038
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '145', '3', '102', '2', '12', '24', '0', '', '1', '2026-09-27 16:19:01', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','11-2,','1','1','0','0','12','24','0','','0','0.00','0','0','0','0'); -- id=992
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 = 992;
 INSERT INTO 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-27', 24, 23.5, 23.5
                    , 23.5, 23.5, 23.5, 23.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 23.5, 23.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24, sellCostBuyPrice =sellCostBuyPrice+23.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23.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-27', 24, 23.5, 23.5
                    , 23.5, 23.5, 23.5, 23.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 23.5, 23.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24, sellCostBuyPrice =sellCostBuyPrice+23.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23.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 = '1257', userid = '1', storedetaildate = '2026-09-27 16:19:01' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '2', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1259', '1257', '1', '2026-09-27 16:19:01','0','0'); -- id=2039
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 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', '145', '3', '120', '2', '15.75', '31.5', '0', '', '1', '2026-09-27 16:19:01', '120', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','10-2,','1','1','0','0','15.75','31.5','0','','0','0.00','0','0','0','0'); -- id=993
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 = 993;
 INSERT INTO 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-27', 31.5, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31.5, sellCostBuyPrice =sellCostBuyPrice+30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 31.5, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31.5, sellCostBuyPrice =sellCostBuyPrice+30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+30, sellCostMeanBuyPrice = sellCostMeanBuyPrice+30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+30
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '269', userid = '1', storedetaildate = '2026-09-27 16:19:01' WHERE storedetailid = '120';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('120', '1', '2', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '271', '269', '1', '2026-09-27 16:19:01','0','0'); -- id=2040
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 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', '145', '3', '103', '1', '5.5', '5.5', '0', '', '1', '2026-09-27 16:19:02', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','8-1,','1','1','0','0','5.5','5.5','0','','0','0.00','0','0','0','0'); -- id=994
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 = 994;
 INSERT INTO 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-27', 5.5, 4.5, 4.5
                    , 4.5, 4.5, 4.5, 4.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 4.5, 4.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5.5, sellCostBuyPrice =sellCostBuyPrice+4.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4.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-27', 5.5, 4.5, 4.5
                    , 4.5, 4.5, 4.5, 4.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4.5, 4.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5.5, sellCostBuyPrice =sellCostBuyPrice+4.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4.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 = '1918', userid = '1', storedetaildate = '2026-09-27 16:19:02' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '1', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1919', '1918', '1', '2026-09-27 16:19:02','0','0'); -- id=2041
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 93;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14','00279', '145', '4', '279', '1', '14.6', '14.6', '0', '', '1', '2026-09-27 16:19:02', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','93-1,','1','1','0','0','14.6','14.6','0','','0','0.00','0','0','0','0'); -- id=995
UPDATE sellbilldetail SET  lastbuyprice = 14.00 , meanbuyprice = 14.00, lastbuyprice_withDiscount = 14.00, meanbuyprice_withDiscount = 14.00
        , lastbuyprice_withTax = 14, meanbuyprice_withTax = 14, lastbuyprice_withDiscountAndTax = 14
                where sellbilldetailid = 995;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (279, '2026-09-27', 14.6, 14, 14
                    , 14, 14, 14, 14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 14, 14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.6, sellCostBuyPrice =sellCostBuyPrice+14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 14.6, 14, 14
                    , 14, 14, 14, 14
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14, 14, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14.6, sellCostBuyPrice =sellCostBuyPrice+14
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '207', userid = '1', storedetaildate = '2026-09-27 16:19:02' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '1', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '208', '207', '1', '2026-09-27 16:19:02','0','0'); -- id=2042
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '145', '6', '296', '2', '9', '18', '0', '', '1', '2026-09-27 16:19:02', '296', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','9','18','0','','0','0.00','0','0','0','0'); -- id=996
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 = 996;
 INSERT INTO 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-27', 18, 15, 15
                    , 15, 15, 15, 15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 15, 15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18, 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+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-27', 18, 15, 15
                    , 15, 15, 15, 15
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18, 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 = '68', userid = '1', storedetaildate = '2026-09-27 16:19:02' WHERE storedetailid = '296';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('296', '1', '2', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '70', '68', '1', '2026-09-27 16:19:02','0','0'); -- id=2043
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '145', '14', '80', '.1', '95', '9.5', '0', '', '1', '2026-09-27 16:19:02', '80', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','95','9.5','0','','0','0.00','0','0','0','0'); -- id=997
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 = 997;
 INSERT INTO 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-27', 9.5, 8.2, 8.2
                    , 8.2, 8.2, 8.2, 8.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0.1, 0, 8.2, 8.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9.5, sellCostBuyPrice =sellCostBuyPrice+8.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+0.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-27', 9.5, 8.2, 8.2
                    , 8.2, 8.2, 8.2, 8.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8.2, 8.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9.5, sellCostBuyPrice =sellCostBuyPrice+8.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8.4', userid = '1', storedetaildate = '2026-09-27 16:19:03' WHERE storedetailid = '80';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('80', '1', '0.1', '1', '145', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8.5', '8.4', '1', '2026-09-27 16:19:03','0','0'); -- id=2044
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-393084.93125',  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 ('-393276.78125','191.85', '0', '1', 'اضافة فاتورة مبيعات', '145', '-393084.93125', '2026-09-27 16:19:03', '1',  'sellbillController.php','1','','0'); -- id=154
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '191.85', '191.85', '2026-09-27', '1', '0', '0', '2026-09-27 16:19:03','اضافة فاتورة مبيعات رقم 145','1','0',null,'0','145','sellbillController.php?do=showDetail&sellbillid=145'); -- id=1009
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1009', '383', '191.85', '','0'); -- id=1009
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-233003.39', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1009', '143', '191.85', '','0'); -- id=1009
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '470112.37', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '183.2', '183.2', '2026-09-27', '1', '0', '0', '2026-09-27 16:19:03','اضافة فاتورة مبيعات رقم 145 - صرف البضاعة من المخزن','1','0',null,'0','145','sellbillController.php?do=showDetail&sellbillid=145'); -- id=1010
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1010', '402', '183.2', '','0'); -- id=1010
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '435830', 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 ('1010', '382', '183.2', '','0'); -- id=1010
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2406373.47', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1009,0,1010' where sellbillid=145;
 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-27', 191.85, 183.2, 183.2
                    , 183.2, 183.2, 183.2, 183.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,183.2, 183.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+191.85, sellCostBuyPrice =sellCostBuyPrice+183.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+183.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+183.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+183.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+183.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+183.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+183.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+183.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 191.85, 183.2, 183.2
                    , 183.2, 183.2, 183.2, 183.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,183.2, 183.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+191.85, sellCostBuyPrice =sellCostBuyPrice+183.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+183.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+183.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+183.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+183.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+183.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+183.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+183.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 191.85, 183.2, 183.2
                    , 183.2, 183.2, 183.2, 183.2, 183.2, 183.2)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+191.85, netSellCostBuyPrice = netSellCostBuyPrice+183.2
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+183.2
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+183.2
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+183.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+183.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+183.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+183.2
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+183.2;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab9172f40e37 and sellbillId = 145 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 12:49:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 16:19:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 16:19:05', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2600
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:25:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 16:55:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-09-27 16:55:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierController.php?do=show'); -- id=2601
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:25:54";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('dailyentry.php', '2026-09-27 16:55:54', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/dailyentry.php?id=4'); -- id=2602
BEGIN;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:25:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 16:56:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-09-27 16:56:00', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/index.php'); -- id=2603
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-27 13:26:01";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-09-27 16:56:05', '1', 'handleExpiredCards', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=2604
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:26:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 16:56:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('capitalController.php', '2026-09-27 16:56:32', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/capitalController.php'); -- id=2605
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:26:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 16:56:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('programsettingsController.php', '2026-09-27 16:56:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/programsettingsController.php'); -- id=2606
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:27:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 16:57:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 16:57:23', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2607
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:48:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 17:18:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-09-27 17:18:38', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=2608
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:49:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 17:19:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-27 17:19:05', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=2609
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 13:49:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 17:19:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-09-27 17:19:24', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=2610
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '20';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('20', '1', '8', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '2', '10', '1', '2026-09-27','0','0'); -- id=2045
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1768', '1768', '2026-09-27', '1', '0', '0', '2026-09-27 17:19:24','اعادة جرد للمنتج : (ديمر مروحه اسمر /كيون) فى مخزن : (المخزن الرئيسي) بالكمية : 10','1','0',null,'0','2045','inventoryController.php?do=details&id=2045'); -- id=1011
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1011', '382', '1768', '','0'); -- id=1011
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2408141.47', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1011', '188', '1768', '','0'); -- id=1011
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-53172.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-27 13:53:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 17:23:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 17:23:11', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2611
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 14:23:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 17:53:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 17:53:32', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2612

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab934e095d5b
-- ----------------------------------------------------------------------------------------------------

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-27 17:53:33', '06ab934e095d5b', '1', '0.00', '0', '0', '1', '14771.50', '14771.5', '14771.5', '0', '1', '2026-09-27 17:53:33', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '100' ,'0','','','','','-1','0','0','0','0','0','14771','0','','0','0','14771.5','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-27','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=146
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','اضافة فاتورة مبيعات','146', '0', '2026-09-27 17:53:33', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14771.5', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-27 17:53:33','0','0','',''); -- id=247
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 80;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5382','00391', '146', '6', '391', '1', '5420', '5420', '0', '', '1', '2026-09-27 17:53:33', '391', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','80-1,','1','1','0','0','5420','5420','0','','0','0.00','0','0','0','0'); -- id=998
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 = 998;
 INSERT INTO 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-27', 5420, 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+5420, 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-27', 5420, 5382, 5382
                    , 5382, 5382, 5382, 5382
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5382, 5382, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5420, 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 = '2', userid = '1', storedetaildate = '2026-09-27 17:53: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', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-09-27 17:53:34','0','0'); -- id=2046
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('445','00269', '146', '10', '269', '1', '600', '600', '0', '', '1', '2026-09-27 17:53:34', '269', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','600','600','0','','0','0.00','0','0','0','0'); -- id=999
UPDATE sellbilldetail SET  lastbuyprice = 445.00 , meanbuyprice = 445.00, lastbuyprice_withDiscount = 445.00, meanbuyprice_withDiscount = 445.00
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 445
                where sellbilldetailid = 999;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (269, '2026-09-27', 600, 445, 445
                    , 445, 445, 445, 445
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 445, 445, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+445
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+445, sellCostMeanBuyPrice = sellCostMeanBuyPrice+445
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+445, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+445
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+445
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+445
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+445
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 600, 445, 445
                    , 445, 445, 445, 445
                    , 0, 0, 0, 0
                    , 0, 0, 0, 445, 445, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+445
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+445, sellCostMeanBuyPrice = sellCostMeanBuyPrice+445
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+445, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+445
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+445
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+445
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+445
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 17:53:34' WHERE storedetailid = '269';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('269', '1', '1', '1', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '3', '1', '2026-09-27 17:53:34','0','0'); -- id=2047
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('730','00249', '146', '10', '249', '2', '810', '1620', '0', '', '1', '2026-09-27 17:53:34', '249', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','810','1620','0','','0','0.00','0','0','0','0'); -- id=1000
UPDATE sellbilldetail SET  lastbuyprice = 730.00 , meanbuyprice = 730.00, lastbuyprice_withDiscount = 730.00, meanbuyprice_withDiscount = 730.00
        , lastbuyprice_withTax = 730, meanbuyprice_withTax = 730, lastbuyprice_withDiscountAndTax = 730
                where sellbilldetailid = 1000;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (249, '2026-09-27', 1620, 1460, 1460
                    , 1460, 1460, 1460, 1460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 1460, 1460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 1620, 1460, 1460
                    , 1460, 1460, 1460, 1460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1460, 1460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1620, sellCostBuyPrice =sellCostBuyPrice+1460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 17:53:34' WHERE storedetailid = '249';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('249', '1', '2', '1', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '8', '1', '2026-09-27 17:53:34','0','0'); -- id=2048
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('65','00255', '146', '10', '255', '28', '73', '2044', '0', '', '1', '2026-09-27 17:53:34', '255', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','73','2044','0','','0','0.00','0','0','0','0'); -- id=1001
UPDATE sellbilldetail SET  lastbuyprice = 65.00 , meanbuyprice = 65.00, lastbuyprice_withDiscount = 65.00, meanbuyprice_withDiscount = 65.00
        , lastbuyprice_withTax = 65, meanbuyprice_withTax = 65, lastbuyprice_withDiscountAndTax = 65
                where sellbilldetailid = 1001;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (255, '2026-09-27', 2044, 1820, 1820
                    , 1820, 1820, 1820, 1820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 28, 0, 1820, 1820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2044, sellCostBuyPrice =sellCostBuyPrice+1820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+28
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 2044, 1820, 1820
                    , 1820, 1820, 1820, 1820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1820, 1820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2044, sellCostBuyPrice =sellCostBuyPrice+1820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-09-27 17:53:34' WHERE storedetailid = '255';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('255', '1', '28', '1', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '79', '51', '1', '2026-09-27 17:53:34','0','0'); -- id=2049
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2600','00252', '146', '10', '252', '1', '3030', '3030', '0', '', '1', '2026-09-27 17:53:34', '252', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3030','3030','0','','0','0.00','0','0','0','0'); -- id=1002
UPDATE sellbilldetail SET  lastbuyprice = 2600.00 , meanbuyprice = 2600.00, lastbuyprice_withDiscount = 2600.00, meanbuyprice_withDiscount = 2600.00
        , lastbuyprice_withTax = 2600, meanbuyprice_withTax = 2600, lastbuyprice_withDiscountAndTax = 2600
                where sellbilldetailid = 1002;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (252, '2026-09-27', 3030, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3030, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 3030, 2600, 2600
                    , 2600, 2600, 2600, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2600, 2600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3030, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 17:53:34' WHERE storedetailid = '252';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('252', '1', '1', '1', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '19', '1', '2026-09-27 17:53:35','0','0'); -- id=2050
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1120','00457', '146', '6', '457', '1', '1150', '1150', '0', '', '1', '2026-09-27 17:53:35', '457', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1150','1150','0','','0','0.00','0','0','0','0'); -- id=1003
UPDATE sellbilldetail SET  lastbuyprice = 1120.00 , meanbuyprice = 1120.00, lastbuyprice_withDiscount = 1120.00, meanbuyprice_withDiscount = 1120.00
        , lastbuyprice_withTax = 1120, meanbuyprice_withTax = 1120, lastbuyprice_withDiscountAndTax = 1120
                where sellbilldetailid = 1003;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (457, '2026-09-27', 1150, 1120, 1120
                    , 1120, 1120, 1120, 1120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1120, 1120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1150, sellCostBuyPrice =sellCostBuyPrice+1120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 1150, 1120, 1120
                    , 1120, 1120, 1120, 1120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1120, 1120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1150, sellCostBuyPrice =sellCostBuyPrice+1120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 17:53:35' WHERE storedetailid = '457';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('457', '1', '1', '1', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-09-27 17:53:35','0','0'); -- id=2051
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('385','00267', '146', '10', '267', '1', '420', '420', '0', '', '1', '2026-09-27 17:53:35', '267', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','420','420','0','','0','0.00','0','0','0','0'); -- id=1004
UPDATE sellbilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 385.00, meanbuyprice_withDiscount = 385.00
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where sellbilldetailid = 1004;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (267, '2026-09-27', 420, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+385
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 420, 385, 385
                    , 385, 385, 385, 385
                    , 0, 0, 0, 0
                    , 0, 0, 0, 385, 385, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+420, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+385
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+385
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-09-27 17:53:35' WHERE storedetailid = '267';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('267', '1', '1', '1', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '4', '1', '2026-09-27 17:53:35','0','0'); -- id=2052
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00261', '146', '10', '261', '65', '7.5', '487.5', '0', '', '1', '2026-09-27 17:53:35', '261', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','7.5','487.5','0','','0','0.00','0','0','0','0'); -- id=1005
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 = 1005;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (261, '2026-09-27', 487.5, 422.5, 422.5
                    , 422.5, 422.5, 422.5, 422.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 0, 422.5, 422.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+487.5, sellCostBuyPrice =sellCostBuyPrice+422.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+422.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+422.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+422.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+422.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+422.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+422.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+422.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+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-27', 487.5, 422.5, 422.5
                    , 422.5, 422.5, 422.5, 422.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 422.5, 422.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+487.5, sellCostBuyPrice =sellCostBuyPrice+422.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+422.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+422.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+422.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+422.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+422.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+422.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+422.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 = '235', userid = '1', storedetaildate = '2026-09-27 17:53:35' WHERE storedetailid = '261';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('261', '1', '65', '1', '146', 'اضافة فاتورة مبيعات', 'sellbillController.php', '300', '235', '1', '2026-09-27 17:53:35','0','0'); -- id=2053
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-378313.4375',  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 ('-393084.9375','14771.5', '0', '1', 'اضافة فاتورة مبيعات', '146', '-378313.4375', '2026-09-27 17:53:35', '1',  'sellbillController.php','1','','0'); -- id=155
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14771.5', '14771.5', '2026-09-27', '1', '0', '0', '2026-09-27 17:53:36','اضافة فاتورة مبيعات رقم 146','1','0',null,'0','146','sellbillController.php?do=showDetail&sellbillid=146'); -- id=1012
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1012', '383', '14771.5', '','0'); -- id=1012
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-218231.89', 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 ('1012', '143', '14771.5', '','0'); -- id=1012
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '484883.87', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13634.5', '13634.5', '2026-09-27', '1', '0', '0', '2026-09-27 17:53:36','اضافة فاتورة مبيعات رقم 146 - صرف البضاعة من المخزن','1','0',null,'0','146','sellbillController.php?do=showDetail&sellbillid=146'); -- id=1013
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1013', '402', '13634.5', '','0'); -- id=1013
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '449464.5', 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 ('1013', '382', '13634.5', '','0'); -- id=1013
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2394506.97', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1012,0,1013' where sellbillid=146;
 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-27', 14771.5, 13634.5, 13634.5
                    , 13634.5, 13634.5, 13634.5, 13634.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13634.5, 13634.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14771.5, sellCostBuyPrice =sellCostBuyPrice+13634.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13634.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13634.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13634.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13634.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13634.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13634.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13634.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 (1, '2026-09-27', 14771.5, 13634.5, 13634.5
                    , 13634.5, 13634.5, 13634.5, 13634.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13634.5, 13634.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14771.5, sellCostBuyPrice =sellCostBuyPrice+13634.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13634.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13634.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13634.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13634.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13634.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13634.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13634.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, 14771.5, 13634.5, 13634.5
                    , 13634.5, 13634.5, 13634.5, 13634.5, 13634.5, 13634.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14771.5, netSellCostBuyPrice = netSellCostBuyPrice+13634.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+13634.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+13634.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+13634.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13634.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+13634.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+13634.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+13634.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab934e095d5b and sellbillId = 146 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 14:23:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 17:53:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 17:53:37', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2613
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 14:30:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 18:00:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 18:00:43', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=2614

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ab93c01f0a26
-- ----------------------------------------------------------------------------------------------------

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-27 18:00:43', '06ab93c01f0a26', '1', '0.00', '0', '0', '1', '269.40', '269.4', '269.4', '0', '1', '2026-09-27 18:00:43', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '38' ,'0','','','','','-1','0','0','0','0','0','269','0','','0','0','269.4','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-09-27','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=147
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','اضافة فاتورة مبيعات','147', '0', '2026-09-27 18:00:44', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '269.4', '0', null, '0', null, null,'', '0','1','1','0','1','2026-09-27 18:00:43','0','0','',''); -- id=248
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00089', '147', '12', '89', '25', '4.9', '122.50000000000001', '0', '', '1', '2026-09-27 18:00:44', '89', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','4.9','122.5','0','','0','0.00','0','0','0','0'); -- id=1006
UPDATE sellbilldetail SET  lastbuyprice = 4.00 , meanbuyprice = 4.25, lastbuyprice_withDiscount = 4.00, meanbuyprice_withDiscount = 4.25
        , lastbuyprice_withTax = 4.25, meanbuyprice_withTax = 4.25, lastbuyprice_withDiscountAndTax = 4
                where sellbilldetailid = 1006;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (89, '2026-09-27', 122.5, 112.5, 100
                    , 106.25, 100, 106.25, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 106.25, 106.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+122.5, sellCostBuyPrice =sellCostBuyPrice+112.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+106.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+106.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+106.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+106.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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-09-27', 122.5, 112.5, 100
                    , 106.25, 100, 106.25, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 106.25, 106.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+122.5, sellCostBuyPrice =sellCostBuyPrice+112.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+106.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+106.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+106.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+106.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 = '175', userid = '1', storedetaildate = '2026-09-27 18:00:44' WHERE storedetailid = '89';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('89', '1', '25', '1', '147', 'اضافة فاتورة مبيعات', 'sellbillController.php', '200', '175', '1', '2026-09-27 18:00:44','0','0'); -- id=2054
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.1','00087', '147', '12', '87', '10', '11.3', '113', '0', '', '1', '2026-09-27 18:00:44', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','113','0','','0','0.00','0','0','0','0'); -- id=1007
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1007;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (87, '2026-09-27', 113, 111, 111
                    , 111, 111, 111, 111
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 111, 111, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+113, sellCostBuyPrice =sellCostBuyPrice+111
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+111, sellCostMeanBuyPrice = sellCostMeanBuyPrice+111
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+111, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+111
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+111
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+111
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+111
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-27', 113, 111, 111
                    , 111, 111, 111, 111
                    , 0, 0, 0, 0
                    , 0, 0, 0, 111, 111, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+113, sellCostBuyPrice =sellCostBuyPrice+111
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+111, sellCostMeanBuyPrice = sellCostMeanBuyPrice+111
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+111, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+111
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+111
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+111
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+111
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-27 18:00:44' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '10', '1', '147', 'اضافة فاتورة مبيعات', 'sellbillController.php', '158', '148', '1', '2026-09-27 18:00:44','0','0'); -- id=2055
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11.1','00088', '147', '12', '88', '3', '11.3', '33.900000000000006', '0', '', '1', '2026-09-27 18:00:44', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','33.9','0','','0','0.00','0','0','0','0'); -- id=1008
UPDATE sellbilldetail SET  lastbuyprice = 11.10 , meanbuyprice = 11.10, lastbuyprice_withDiscount = 11.10, meanbuyprice_withDiscount = 11.10
        , lastbuyprice_withTax = 11.1, meanbuyprice_withTax = 11.1, lastbuyprice_withDiscountAndTax = 11.1
                where sellbilldetailid = 1008;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (88, '2026-09-27', 33.9, 33.3, 33.3
                    , 33.3, 33.3, 33.3, 33.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 33.3, 33.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33.9, sellCostBuyPrice =sellCostBuyPrice+33.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+33.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+33.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+33.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+33.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+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-27', 33.9, 33.3, 33.3
                    , 33.3, 33.3, 33.3, 33.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 33.3, 33.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+33.9, sellCostBuyPrice =sellCostBuyPrice+33.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+33.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+33.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+33.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+33.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 = '121', userid = '1', storedetaildate = '2026-09-27 18:00:45' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '3', '1', '147', 'اضافة فاتورة مبيعات', 'sellbillController.php', '124', '121', '1', '2026-09-27 18:00:45','0','0'); -- id=2056
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-378044.0375',  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 ('-378313.4375','269.4', '0', '1', 'اضافة فاتورة مبيعات', '147', '-378044.0375', '2026-09-27 18:00:45', '1',  'sellbillController.php','1','','0'); -- id=156
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '269.4', '269.4', '2026-09-27', '1', '0', '0', '2026-09-27 18:00:45','اضافة فاتورة مبيعات رقم 147','1','0',null,'0','147','sellbillController.php?do=showDetail&sellbillid=147'); -- id=1014
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1014', '383', '269.4', '','0'); -- id=1014
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-217962.49', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1014', '143', '269.4', '','0'); -- id=1014
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '485153.27', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '244.3', '244.3', '2026-09-27', '1', '0', '0', '2026-09-27 18:00:45','اضافة فاتورة مبيعات رقم 147 - صرف البضاعة من المخزن','1','0',null,'0','147','sellbillController.php?do=showDetail&sellbillid=147'); -- id=1015
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1015', '402', '244.3', '','0'); -- id=1015
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '449708.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 ('1015', '382', '244.3', '','0'); -- id=1015
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2394262.67', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1014,0,1015' where sellbillid=147;
 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-27', 269.4, 256.8, 244.3
                    , 250.55, 244.3, 250.55, 244.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,250.55, 250.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+269.4, sellCostBuyPrice =sellCostBuyPrice+256.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+244.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+250.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+244.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+250.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+244.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+250.55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+250.55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 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-27', 269.4, 256.8, 244.3
                    , 250.55, 244.3, 250.55, 244.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,250.55, 250.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+269.4, sellCostBuyPrice =sellCostBuyPrice+256.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+244.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+250.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+244.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+250.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+244.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+250.55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+250.55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 269.4, 256.8, 244.3
                    , 250.55, 244.3, 250.55, 244.3, 250.55, 250.55)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+269.4, netSellCostBuyPrice = netSellCostBuyPrice+256.8
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+244.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+250.55
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+244.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+250.55
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+244.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+250.55
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+250.55;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ab93c01f0a26 and sellbillId = 147 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 14:30:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 18:00:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 18:00:46', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2615
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 15:38:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 19:08:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 19:08:28', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=147'); -- id=2616
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 15:38:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 19:08:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 19:08:52', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2617
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 15:39:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 19:09:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 19:09:12', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2618
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 15:39:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 19:09:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 19:09:21', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2619
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 15:39:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 19:09:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 19:09:27', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=146'); -- id=2620
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-27 19:10:38', '1', '0','','0','','-10','0','10000',',','-1','0','.','0','0','.','2026-09-27','0','0','','0','0','0','','','0','0','','','','','','','','','','-1','','','','0','','','0','0',''); -- id=39
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('39', '0', '0', '', ''); -- id=39
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('39','0','0','0','إضافة عميل جديد','39', '0', '2026-09-27 19:10:38', '1', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1','','0','0','',''); -- id=249
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-27 19:10:39'); -- id=471
UPDATE client SET clientname = 'محمد عباس الطوخي', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2026-09-27', 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='471',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 = '39';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:04:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:34:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 21:34:43', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2621
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:14:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:44:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 21:44:29', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2622
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:14:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:44:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 21:44:30', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=2623
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:14:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:44:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 21:44:52', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=2624

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =250
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(5,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '3506.1' , clientdate = '2026-09-27 21:44:52', userid = '1' WHERE clientid = '5';
UPDATE client SET  inUse = 0 where clientid = 5;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('5','10506.10','7000','1','ايصال تحصيل (( قبض من عميل ))','250', '3506.1', '2026-09-27 21:44:30', '1', 'clientPayedDeptController.php', '   ', '7000', '0', null, '0', null, null,'', '-1','1','1','7000','1','','21','0','','.'); -- id=250
UPDATE save SET  savecurrentvalue = '-371044.04',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-378044.04','7000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '250', '-371044.04', '2026-09-27 21:44:52', '1',  'clientPayedDeptController.php','5','','0'); -- id=157
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7000', '7000', '2026-09-27', '1', '0', '0', '2026-09-27 21:44:52','اضافة ايصال سداد للعميل احمد عبدالحميد حسون ','1','0','0','0','250','clientPayedDeptController.php?do=show&id=250'); -- id=1016
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1016', '383', '7000', '','0'); -- id=1016
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-210962.49', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1016', '430', '7000', '','0'); -- id=1016
UPDATE accountstree SET name = 'احمد عبدالحميد حسون ', customName = 'احمد عبدالحميد حسون ', customNameEn = 'احمد عبدالحميد حسون ', nameEn = 'احمد عبدالحميد حسون ', parent = '58', accountNature = '0', theValue = '3506.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 14:49:28' WHERE id = '430';
UPDATE clientdebtchange SET clientid = '5', clientdebtchangebefore = '10506.100', clientdebtchangeamount = '7000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '250', clientdebtchangeafter = '3506.100', clientdebtchangedate = '2026-09-27 21:44:30', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '7000.000',discount='', reciptid='0', dailyentryid = '1016',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='7000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '250';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:14:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:44:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 21:44:53', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=2625
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:14:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:44:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-09-27 21:44:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=2626
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:14:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:44:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 21:44:58', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2627
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:15:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:45:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 21:45:16', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2628
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:15:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:45:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 21:45:22', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=143'); -- id=2629
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:18:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 21:48:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 21:48:22', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=2630
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:35:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:05:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-27 22:05:01', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=2631
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:35:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:05:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-09-27 22:05:08', '1', 'oneSupplier', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=2632
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:36:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:06:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 22:06:54', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=2633
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:38:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:08:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 22:08:11', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=2634
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 ('06ab977682ab5f', '2026-09-27 22:07:04', '10', '28160.00', '28940', '0', '0', '780.00',  '780.00', '0', '780', '1', '2026-09-27 22:08:12', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=30
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 ('00197', '30', '20', '197', '3', '260', '780.00', '0', '', '2026-09-27 22:08:12', '197','','','0','0','0','0','0',null,'260','780','0','0','0','0','0','0','0','0','1'); -- id=108
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-27 22:07:04', 1, 197, 0, 0
                    , 260, 3, 0, 0, 1, '2026-09-27 22:08:12')
                ON DUPLICATE KEY UPDATE buyprice = 260,
                        buyQuantity =buyQuantity+3, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-09-27 22:08:12' ; -- id=108
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('197', '260', '3', '0', 'buyBillController.php', '108', '', '0', '0'); -- id=108
UPDATE product SET  productBuyPrice = "260" WHERE productId = 197 ;
UPDATE buybilldetail SET  quantitybefore = 100 WHERE buybilldetailid = 108 ;
UPDATE product SET productName = 'لفه بروفايل ابيض ', productDescription = '', productCatId = '20', productBuyPrice = '260.00', productSellAllPrice = '220.00', productSellUnitPrice = '245.00', productSellHalfPrice = '220.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00197',type ='0', expireDate = '0' , dailyentryId = '224',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '211.46',meanbuyprice_withDiscount = '211.46' , productbuypricereal = '210.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.76' , buyhalf_precentage = '4.76' , buypart_precentage = '16.67',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='210',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='211.46',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '197';
UPDATE buybilldetail SET  lastbuyprice = 260 , meanbuyprice = 211.46, lastbuyprice_withDiscount = 260, meanbuyprice_withDiscount = 211.46
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 211.46, lastbuyprice_withDiscountAndTax = 260
                where buybilldetailid = 108;
UPDATE productunit SET proUnitBuyPrice  = 260 * productnumber WHERE productid = 197;
UPDATE storedetail SET  productquantity = '103', userid = '1', storedetaildate = '2026-09-27' WHERE storedetailid = '197';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('197', '1', '3', '0', '30', 'اضافة فاتورة مشتريات', 'buyBillController.php', '100', '103', '1', '2026-09-27 22:07:04','0','0'); -- id=2057
UPDATE supplier SET  suppliercurrentDebt = '28940',suppliercurrentDebtInCurrency= '28940' , userid = '1', supplierdate = '2026-09-27 22:08:12'   WHERE supplierid = '10';
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 ('10', '28160.00', '780', '0', 'اضافة فاتورة مشتريات', '30', '28940', '2026-09-27 22:07:04', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','780','1','28160','780','28940','0',''); -- id=56
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '780', '780', '2026-09-27', '1', '0', '0', '2026-09-27 22:08:13','اضافة فاتورة مشتريات رقم 30','1','0',null,'0','30','buyBillController.php?do=details&id=30'); -- id=1017
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1017', '382', '780', '','0'); -- id=1017
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2395042.67', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1017', '433', '780', '','0'); -- id=1017
UPDATE accountstree SET name = 'شركه باندا حساب محمد', customName = 'شركه باندا حساب محمد', customNameEn = 'شركه باندا حساب محمد', nameEn = 'شركه باندا حساب محمد', parent = '81', accountNature = '1', theValue = '28940', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-15 22:21:33' WHERE id = '433';
update buybill set dailyentryid='1017,0' where buybillid=30;
COMMIT;
UPDATE product SET overAllAveragePrice = 260 WHERE productId = 197;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:38:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:08:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-09-27 22:08:14', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=30'); -- id=2635
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:39:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:09:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 22:09:19', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=2636
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:39:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:09:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-09-27 22:09:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=2637
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:39:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:09:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 22:09:36', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=143'); -- id=2638
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-09-27 18:39:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-09-27 22:09:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-09-27 22:09:52', '1', 'showDetail', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=showDetail&sellbillid=142'); -- id=2639
