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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad5cc6d650ca
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 09:53:42', '06ad5cc6d650ca', '46', '1986.00', '2176', '0', '1', '190.00', '190', '0', '190', '1', '2026-10-19 09:53:42', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '10' ,'0','','','','','-1','0','0','0','0','0','190','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=335
UPDATE client SET  clientdebt = '2176', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','1986.00','190','0','اضافة فاتورة مبيعات','335', '2176', '2026-10-19 09:53:43', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '190', '0', null, '0', null, null,'', '0','1','1','190','1','2026-10-19 09:53:42','0','0','',''); -- id=568
UPDATE client SET  inUse = 0 where clientid = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '335', '14', '81', '10', '19', '190', '0', '', '1', '2026-10-19 09:53:43', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=2678
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2678;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 09:53:43' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '335', 'اضافة فاتورة مبيعات', 'sellbillController.php', '68', '58', '1', '2026-10-19 09:53:43','0','0'); -- id=4754
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '190', '190', '2026-10-19', '1', '0', '0', '2026-10-19 09:53:44','اضافة فاتورة مبيعات رقم 335','1','0',null,'0','335','sellbillController.php?do=showDetail&sellbillid=335'); -- id=1741
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1741', '479', '190', '','0'); -- id=1757
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '2176', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1741', '143', '190', '','0'); -- id=1745
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1488225.33', 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 ( '180', '180', '2026-10-19', '1', '0', '0', '2026-10-19 09:53:44','اضافة فاتورة مبيعات رقم 335 - صرف البضاعة من المخزن','1','0',null,'0','335','sellbillController.php?do=showDetail&sellbillid=335'); -- id=1742
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1742', '402', '180', '','0'); -- id=1758
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1329038.33', 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 ('1742', '382', '180', '','0'); -- id=1746
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2211095.77', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1741,0,1742' where sellbillid=335;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 190, 180, 180
                    , 180, 180, 180, 180, 180, 180)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+190, netSellCostBuyPrice = netSellCostBuyPrice+180
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+180
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+180
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+180
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+180
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+180
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+180
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+180;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad5cc6d650ca and sellbillId = 335 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:23:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 09:53:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 09:53:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4533
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('ديمر صوت ابيض ','','1','202','202','208','202','2026-10-19','0','1','1','11281','0','0','0','0','0','202','202','202','202','202','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','202','202','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=605
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (605, 1,'2026-10-19 09:56:58',1)
                ON DUPLICATE KEY UPDATE productid = 605, edited = 1, sysdate = '2026-10-19 09:56:58', userid = 1; -- id=807
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', '605', '1', '2026-10-19', '1', '0','0060501','202','202','208','202','','0','0','0','0','0','0','0','0','0','0'); -- id=605
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('605', '1', '30', '1', '2026-10-19'); -- id=605
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('605', '1', '30', '0', '605', 'إضافة منتج', 'productController.php', '0', '30', '1', '2026-10-19','0','0'); -- id=4755
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6060', '6060', '2026-10-19', '1', '0', '0', '2026-10-19 09:56:59','إضافة منتج ديمر صوت ابيض  الكمية 30','1','0','0','0','0',''); -- id=1743
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1743', '382', '6060', '','0'); -- id=1759
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2217155.77', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1743', '121', '6060', '','0'); -- id=1747
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1849874.77', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:28:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 09:58:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-19 09:58:42', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4534
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 ('06ad5cc73c98d9', '2026-10-19 09:53:23', '1', '81528.92', '81528.92', '0', '0', '104414.80',  '104414.80', '104414.800', '0', '1', '2026-10-19 09:58:42', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=60
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 ('00001', '60', '1', '1', '600', '52.75', '31650.00', '0', '', '2026-10-19 09:58:42', '1','','','0','0','0','0','0',null,'52.75','31650','0','0','0','0','0','0','0','0','1'); -- id=212
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 1, 0, 0
                    , 52.75, 600, 0, 0, 1, '2026-10-19 09:58:43')
                ON DUPLICATE KEY UPDATE buyprice = 52.75,
                        buyQuantity =buyQuantity+600, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:43' ; -- id=212
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1', '52.75', '600', '0', 'buyBillController.php', '212', '', '0', '0'); -- id=212
UPDATE product SET  productBuyPrice = "52.75" WHERE productId = 1 ;
UPDATE buybilldetail SET  quantitybefore = 1715 WHERE buybilldetailid = 212 ;
UPDATE product SET productName = 'شاسيه بالوش اسمر ', productDescription = '', productCatId = '1', productBuyPrice = '52.75', productSellAllPrice = '53.33', productSellUnitPrice = '54.78', productSellHalfPrice = '53.33', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '0', parcode = '00001',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '52.75',lastbuyprice_withDiscount = '52.75',meanbuyprice = '52.75',meanbuyprice_withDiscount = '52.75' , productbuypricereal = '52.75' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.10' , buyhalf_precentage = '1.10' , buypart_precentage = '3.85',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='52.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='52.75',meanbuyprice_withTax='52.75',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='52.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 = '1';
UPDATE buybilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where buybilldetailid = 212;
UPDATE productunit SET proUnitBuyPrice  = 52.75 * productnumber WHERE productid = 1;
UPDATE storedetail SET  productquantity = '2315', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '600', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1715', '2315', '1', '2026-10-19 09:53:23','0','0'); -- id=4756
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 ('00041', '60', '1', '41', '600', '44.33', '26598.00', '0', '', '2026-10-19 09:58:42', '41','','','0','0','0','0','0',null,'44.33','26598','0','0','0','0','0','0','0','0','1'); -- id=213
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 41, 0, 0
                    , 44.33, 600, 0, 0, 1, '2026-10-19 09:58:44')
                ON DUPLICATE KEY UPDATE buyprice = 44.33,
                        buyQuantity =buyQuantity+600, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:44' ; -- id=213
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('41', '44.33', '600', '0', 'buyBillController.php', '213', '', '0', '0'); -- id=213
UPDATE product SET  productBuyPrice = "44.33" WHERE productId = 41 ;
UPDATE buybilldetail SET  quantitybefore = 484 WHERE buybilldetailid = 213 ;
UPDATE product SET productName = 'شاسيه بالوش ابيض ', productDescription = '', productCatId = '1', productBuyPrice = '44.33', productSellAllPrice = '45.00', productSellUnitPrice = '46.00', productSellHalfPrice = '45.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '200', parcode = '00041',type ='0', expireDate = '0' , dailyentryId = '53',isService = '0',isOptic = '0',lastbuyprice = '44.33',lastbuyprice_withDiscount = '44.33',meanbuyprice = '44.33',meanbuyprice_withDiscount = '44.33' , productbuypricereal = '44.33' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.51' , buyhalf_precentage = '1.51' , buypart_precentage = '3.77',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='44.33',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='44.33',meanbuyprice_withTax='44.33',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='44.33',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '41';
UPDATE buybilldetail 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 buybilldetailid = 213;
UPDATE productunit SET proUnitBuyPrice  = 44.33 * productnumber WHERE productid = 41;
UPDATE storedetail SET  productquantity = '1084', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '41';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('41', '1', '600', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '484', '1084', '1', '2026-10-19 09:53:23','0','0'); -- id=4757
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 ('00042', '60', '1', '42', '360', '29.5', '10620.00', '0', '', '2026-10-19 09:58:42', '42','','','0','0','0','0','0',null,'29.5','10620','0','0','0','0','0','0','0','0','1'); -- id=214
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 42, 0, 0
                    , 29.5, 360, 0, 0, 1, '2026-10-19 09:58:44')
                ON DUPLICATE KEY UPDATE buyprice = 29.5,
                        buyQuantity =buyQuantity+360, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:44' ; -- id=214
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('42', '29.5', '360', '0', 'buyBillController.php', '214', '', '0', '0'); -- id=214
UPDATE product SET  productBuyPrice = "29.5" WHERE productId = 42 ;
UPDATE buybilldetail SET  quantitybefore = 765 WHERE buybilldetailid = 214 ;
UPDATE product SET productName = 'مفتاح مفرد ابيض ', productDescription = '', productCatId = '1', productBuyPrice = '29.50', productSellAllPrice = '29.90', productSellUnitPrice = '30.75', productSellHalfPrice = '29.90', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '360', parcode = '00042',type ='0', expireDate = '0' , dailyentryId = '54',isService = '0',isOptic = '0',lastbuyprice = '29.5',lastbuyprice_withDiscount = '29.5',meanbuyprice = '29.5',meanbuyprice_withDiscount = '29.5' , productbuypricereal = '29.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.36' , buyhalf_precentage = '1.36' , buypart_precentage = '4.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='29.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='29.5',meanbuyprice_withTax='29.5',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='29.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 = '42';
UPDATE buybilldetail SET  lastbuyprice = 29.5 , meanbuyprice = 29.5, lastbuyprice_withDiscount = 29.5, meanbuyprice_withDiscount = 29.5
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where buybilldetailid = 214;
UPDATE productunit SET proUnitBuyPrice  = 29.5 * productnumber WHERE productid = 42;
UPDATE storedetail SET  productquantity = '1125', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '42';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('42', '1', '360', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '765', '1125', '1', '2026-10-19 09:53:23','0','0'); -- id=4758
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 ('11281', '60', '1', '605', '1', '202', '202.00', '0', '', '2026-10-19 09:58:42', '605','','','0','0','0','0','0',null,'202','202','0','0','0','0','0','0','0','0','1'); -- id=215
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 605, 0, 0
                    , 202, 1, 0, 0, 1, '2026-10-19 09:58:45')
                ON DUPLICATE KEY UPDATE buyprice = 202,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:45' ; -- id=215
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('605', '202', '1', '0', 'buyBillController.php', '215', '', '0', '0'); -- id=215
UPDATE product SET  productBuyPrice = "202" WHERE productId = 605 ;
UPDATE buybilldetail SET  quantitybefore = 30 WHERE buybilldetailid = 215 ;
UPDATE product SET productName = 'ديمر صوت ابيض ', productDescription = '', productCatId = '1', productBuyPrice = '202.00', productSellAllPrice = '202.00', productSellUnitPrice = '208.00', productSellHalfPrice = '202.00', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '1', parcode = '11281',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '202',lastbuyprice_withDiscount = '202',meanbuyprice = '202',meanbuyprice_withDiscount = '202' , productbuypricereal = '202.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='202',meanbuyprice_withTax='202',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='202',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '605';
UPDATE buybilldetail SET  lastbuyprice = 202 , meanbuyprice = 202, lastbuyprice_withDiscount = 202, meanbuyprice_withDiscount = 202
        , lastbuyprice_withTax = 202, meanbuyprice_withTax = 202, lastbuyprice_withDiscountAndTax = 202
                where buybilldetailid = 215;
UPDATE productunit SET proUnitBuyPrice  = 202 * productnumber WHERE productid = 605;
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '605';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('605', '1', '1', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '30', '31', '1', '2026-10-19 09:53:23','0','0'); -- id=4759
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 ('00007', '60', '1', '7', '80', '84.46', '6756.80', '0', '', '2026-10-19 09:58:42', '7','','','0','0','0','0','0',null,'84.46','6756.8','0','0','0','0','0','0','0','0','1'); -- id=216
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 7, 0, 0
                    , 84.46, 80, 0, 0, 1, '2026-10-19 09:58:46')
                ON DUPLICATE KEY UPDATE buyprice = 84.46,
                        buyQuantity =buyQuantity+80, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:46' ; -- id=216
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('7', '84.46', '80', '0', 'buyBillController.php', '216', '', '0', '0'); -- id=216
UPDATE product SET  productBuyPrice = "84.46" WHERE productId = 7 ;
UPDATE buybilldetail SET  quantitybefore = 106 WHERE buybilldetailid = 216 ;
UPDATE product SET productName = 'قطعه تلفون اسمر ', productDescription = '', productCatId = '1', productBuyPrice = '84.46', productSellAllPrice = '84.50', productSellUnitPrice = '87.00', productSellHalfPrice = '84.50', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '40', parcode = '00007',type ='0', expireDate = '0' , dailyentryId = '12',isService = '0',isOptic = '0',lastbuyprice = '84.46',lastbuyprice_withDiscount = '84.46',meanbuyprice = '84.46',meanbuyprice_withDiscount = '84.46' , productbuypricereal = '84.46' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.05' , buyhalf_precentage = '0.05' , buypart_precentage = '3.01',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='84.46',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='84.46',meanbuyprice_withTax='84.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='84.46',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '7';
UPDATE buybilldetail SET  lastbuyprice = 84.46 , meanbuyprice = 84.46, lastbuyprice_withDiscount = 84.46, meanbuyprice_withDiscount = 84.46
        , lastbuyprice_withTax = 84.46, meanbuyprice_withTax = 84.46, lastbuyprice_withDiscountAndTax = 84.46
                where buybilldetailid = 216;
UPDATE productunit SET proUnitBuyPrice  = 84.46 * productnumber WHERE productid = 7;
UPDATE storedetail SET  productquantity = '186', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '7';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('7', '1', '80', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '106', '186', '1', '2026-10-19 09:53:23','0','0'); -- id=4760
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 ('00014', '60', '1', '14', '80', '47', '3760.00', '0', '', '2026-10-19 09:58:42', '14','','','0','0','0','0','0',null,'47','3760','0','0','0','0','0','0','0','0','1'); -- id=217
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 14, 0, 0
                    , 47, 80, 0, 0, 1, '2026-10-19 09:58:47')
                ON DUPLICATE KEY UPDATE buyprice = 47,
                        buyQuantity =buyQuantity+80, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:47' ; -- id=217
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('14', '47', '80', '0', 'buyBillController.php', '217', '', '0', '0'); -- id=217
UPDATE product SET  productBuyPrice = "47" WHERE productId = 14 ;
UPDATE buybilldetail SET  quantitybefore = 58 WHERE buybilldetailid = 217 ;
UPDATE product SET productName = 'لقمه دش اسمر ', productDescription = '', productCatId = '1', productBuyPrice = '47.00', productSellAllPrice = '48.00', productSellUnitPrice = '49.90', productSellHalfPrice = '48.00', productDate = '2026-09-13', conditions = '0', userId = '1', limitamount = '40', parcode = '00014',type ='0', expireDate = '0' , dailyentryId = '19',isService = '0',isOptic = '0',lastbuyprice = '47',lastbuyprice_withDiscount = '47',meanbuyprice = '47',meanbuyprice_withDiscount = '47' , productbuypricereal = '47.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.13' , buyhalf_precentage = '2.13' , buypart_precentage = '6.17',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='47',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='47',meanbuyprice_withTax='47',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='47',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '14';
UPDATE buybilldetail SET  lastbuyprice = 47 , meanbuyprice = 47, lastbuyprice_withDiscount = 47, meanbuyprice_withDiscount = 47
        , lastbuyprice_withTax = 47, meanbuyprice_withTax = 47, lastbuyprice_withDiscountAndTax = 47
                where buybilldetailid = 217;
UPDATE productunit SET proUnitBuyPrice  = 47 * productnumber WHERE productid = 14;
UPDATE storedetail SET  productquantity = '138', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '14';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('14', '1', '80', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '58', '138', '1', '2026-10-19 09:53:23','0','0'); -- id=4761
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 ('00043', '60', '1', '43', '360', '29.5', '10620.00', '0', '', '2026-10-19 09:58:42', '43','','','0','0','0','0','0',null,'29.5','10620','0','0','0','0','0','0','0','0','1'); -- id=218
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 43, 0, 0
                    , 29.5, 360, 0, 0, 1, '2026-10-19 09:58:48')
                ON DUPLICATE KEY UPDATE buyprice = 29.5,
                        buyQuantity =buyQuantity+360, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:48' ; -- id=218
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('43', '29.5', '360', '0', 'buyBillController.php', '218', '', '0', '0'); -- id=218
UPDATE product SET  productBuyPrice = "29.5" WHERE productId = 43 ;
UPDATE buybilldetail SET  quantitybefore = 717 WHERE buybilldetailid = 218 ;
UPDATE product SET productName = 'بريزه مفرد ابيض ', productDescription = '', productCatId = '1', productBuyPrice = '29.50', productSellAllPrice = '29.90', productSellUnitPrice = '30.75', productSellHalfPrice = '29.90', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '360', parcode = '00043',type ='0', expireDate = '0' , dailyentryId = '55',isService = '0',isOptic = '0',lastbuyprice = '29.5',lastbuyprice_withDiscount = '29.5',meanbuyprice = '29.5',meanbuyprice_withDiscount = '29.5' , productbuypricereal = '29.50' , buypricereal_precentage = '0.00' , buytotal_precentage = '1.36' , buyhalf_precentage = '1.36' , buypart_precentage = '4.24',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='29.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='29.5',meanbuyprice_withTax='29.5',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='29.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 = '43';
UPDATE buybilldetail SET  lastbuyprice = 29.5 , meanbuyprice = 29.5, lastbuyprice_withDiscount = 29.5, meanbuyprice_withDiscount = 29.5
        , lastbuyprice_withTax = 29.5, meanbuyprice_withTax = 29.5, lastbuyprice_withDiscountAndTax = 29.5
                where buybilldetailid = 218;
UPDATE productunit SET proUnitBuyPrice  = 29.5 * productnumber WHERE productid = 43;
UPDATE storedetail SET  productquantity = '1077', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '43';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('43', '1', '360', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '717', '1077', '1', '2026-10-19 09:53:23','0','0'); -- id=4762
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 ('00044', '60', '1', '44', '500', '8.44', '4220.00', '0', '', '2026-10-19 09:58:42', '44','','','0','0','0','0','0',null,'8.44','4220','0','0','0','0','0','0','0','0','1'); -- id=219
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 44, 0, 0
                    , 8.44, 500, 0, 0, 1, '2026-10-19 09:58:49')
                ON DUPLICATE KEY UPDATE buyprice = 8.44,
                        buyQuantity =buyQuantity+500, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:49' ; -- id=219
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('44', '8.44', '500', '0', 'buyBillController.php', '219', '', '0', '0'); -- id=219
UPDATE product SET  productBuyPrice = "8.44" WHERE productId = 44 ;
UPDATE buybilldetail SET  quantitybefore = 1531 WHERE buybilldetailid = 219 ;
UPDATE product SET productName = 'سداد ابيض ', productDescription = '', productCatId = '1', productBuyPrice = '8.44', productSellAllPrice = '8.50', productSellUnitPrice = '8.80', productSellHalfPrice = '8.50', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '500', parcode = '00044',type ='0', expireDate = '0' , dailyentryId = '56',isService = '0',isOptic = '0',lastbuyprice = '8.44',lastbuyprice_withDiscount = '8.44',meanbuyprice = '8.44',meanbuyprice_withDiscount = '8.44' , productbuypricereal = '8.44' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.71' , buyhalf_precentage = '0.71' , buypart_precentage = '4.27',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='8.44',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='8.44',meanbuyprice_withTax='8.44',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='8.44',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '44';
UPDATE buybilldetail 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 buybilldetailid = 219;
UPDATE productunit SET proUnitBuyPrice  = 8.44 * productnumber WHERE productid = 44;
UPDATE storedetail SET  productquantity = '2031', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '44';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('44', '1', '500', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1531', '2031', '1', '2026-10-19 09:53:23','0','0'); -- id=4763
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 ('00065', '60', '1', '65', '24', '262', '6288.00', '0', '', '2026-10-19 09:58:42', '65','','','0','0','0','0','0',null,'262','6288','0','0','0','0','0','0','0','0','1'); -- id=220
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 65, 0, 0
                    , 262, 24, 0, 0, 1, '2026-10-19 09:58:50')
                ON DUPLICATE KEY UPDATE buyprice = 262,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:50' ; -- id=220
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('65', '262', '24', '0', 'buyBillController.php', '220', '', '0', '0'); -- id=220
UPDATE product SET  productBuyPrice = "262" WHERE productId = 65 ;
UPDATE buybilldetail SET  quantitybefore = 4 WHERE buybilldetailid = 220 ;
UPDATE product SET productName = 'مفتاح اتوماتيك مجوز 63 امبير ', productDescription = '', productCatId = '1', productBuyPrice = '262.00', productSellAllPrice = '264.00', productSellUnitPrice = '275.00', productSellHalfPrice = '264.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '1', parcode = '00065',type ='0', expireDate = '0' , dailyentryId = '76',isService = '0',isOptic = '0',lastbuyprice = '262',lastbuyprice_withDiscount = '262',meanbuyprice = '262',meanbuyprice_withDiscount = '262' , productbuypricereal = '262.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.76' , buyhalf_precentage = '0.76' , buypart_precentage = '4.96',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='262',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='262',meanbuyprice_withTax='262',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='262',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '65';
UPDATE buybilldetail SET  lastbuyprice = 262 , meanbuyprice = 262, lastbuyprice_withDiscount = 262, meanbuyprice_withDiscount = 262
        , lastbuyprice_withTax = 262, meanbuyprice_withTax = 262, lastbuyprice_withDiscountAndTax = 262
                where buybilldetailid = 220;
UPDATE productunit SET proUnitBuyPrice  = 262 * productnumber WHERE productid = 65;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '65';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('65', '1', '24', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '4', '28', '1', '2026-10-19 09:53:23','0','0'); -- id=4764
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 ('00592', '60', '1', '592', '1', '3700', '3700.00', '0', '', '2026-10-19 09:58:42', '592','','','0','0','0','0','0',null,'3700','3700','0','0','0','0','0','0','0','0','1'); -- id=221
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 09:53:23', 1, 592, 0, 0
                    , 3700, 1, 0, 0, 1, '2026-10-19 09:58:51')
                ON DUPLICATE KEY UPDATE buyprice = 3700,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 09:58:51' ; -- id=221
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('592', '3700', '1', '0', 'buyBillController.php', '221', '', '0', '0'); -- id=221
UPDATE product SET  productBuyPrice = "3700" WHERE productId = 592 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 221 ;
UPDATE product SET productName = 'مفتاح كوتله 250 امبير ', productDescription = '', productCatId = '1', productBuyPrice = '3700.00', productSellAllPrice = '3800.00', productSellUnitPrice = '3950.00', productSellHalfPrice = '3800.00', productDate = '2026-10-11', conditions = '0', userId = '1', limitamount = '1', parcode = '00592',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '3700',lastbuyprice_withDiscount = '3700',meanbuyprice = '3700',meanbuyprice_withDiscount = '3700' , productbuypricereal = '3700.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='3700',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='3700',meanbuyprice_withTax='3700',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='3700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '592';
UPDATE buybilldetail SET  lastbuyprice = 3700 , meanbuyprice = 3700, lastbuyprice_withDiscount = 3700, meanbuyprice_withDiscount = 3700
        , lastbuyprice_withTax = 3700, meanbuyprice_withTax = 3700, lastbuyprice_withDiscountAndTax = 3700
                where buybilldetailid = 221;
UPDATE productunit SET proUnitBuyPrice  = 3700 * productnumber WHERE productid = 592;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '592';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('592', '1', '1', '0', '60', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1', '1', '2026-10-19 09:53:23','0','0'); -- id=4765
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-19 09:58:42'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '81528.92', '0', '0', 'اضافة فاتورة مشتريات', '60', '81528.92', '2026-10-19 09:53:23', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=105
UPDATE save SET  savecurrentvalue = '-839847.8',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-735433.00','104414.8', '1', '1', 'اضافة فاتورة مشتريات', '60', '-839847.8', '2026-10-19 09:53:23', '1',  'buyBillController.php','0','','0'); -- id=352
update buybill set dailyentryid='0,0' where buybillid=60;
COMMIT;
UPDATE product SET overAllAveragePrice = 52.75 WHERE productId = 1;UPDATE product SET overAllAveragePrice = 84.46 WHERE productId = 7;UPDATE product SET overAllAveragePrice = 47 WHERE productId = 14;UPDATE product SET overAllAveragePrice = 44.33 WHERE productId = 41;UPDATE product SET overAllAveragePrice = 29.5 WHERE productId = 42;UPDATE product SET overAllAveragePrice = 29.5 WHERE productId = 43;UPDATE product SET overAllAveragePrice = 8.44 WHERE productId = 44;UPDATE product SET overAllAveragePrice = 262 WHERE productId = 65;UPDATE product SET overAllAveragePrice = 3700 WHERE productId = 592;UPDATE product SET overAllAveragePrice = 202 WHERE productId = 605;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:28:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 09:58:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-19 09:58:52', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=60'); -- id=4535
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:38:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:08:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:08:41', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4536
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:38:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:08:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:08:56', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4537
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:39:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:09:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:09:06', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=257'); -- id=4538
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:39:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:09:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:09:30', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4539
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 257;
UPDATE sellbill SET  sellbillsysdate = '2026-10-19 10:09:31', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '257';
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 2133;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (190, '2026-10-19', 150, 130, 130
                    , 130, 130, 130, 130
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 130, 130, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-150, sellCostBuyPrice =sellCostBuyPrice-130
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-130, sellCostMeanBuyPrice = sellCostMeanBuyPrice-130
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-130, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-130
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-130
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-130
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-130
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 150, 130, 130
                    , 130, 130, 130, 130
                    , 0, 0, 0, 0
                    , 0, 0, 0, 130, 130, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-150, sellCostBuyPrice =sellCostBuyPrice-130
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-130, sellCostMeanBuyPrice = sellCostMeanBuyPrice-130
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-130, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-130
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-130
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-130
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-130
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '176', userid = '1', storedetaildate = '2026-10-19 10:09:31' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '10', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '166', '176', '1', '2026-10-09 17:28:12','0','0'); -- id=4766
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 = 2134;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-19', 480, 427.2, 427.2
                    , 427.2, 427.2, 427.2, 427.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 427.2, 427.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-427.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-427.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-427.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-427.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-427.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-427.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-427.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-427.2
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 480, 427.2, 427.2
                    , 427.2, 427.2, 427.2, 427.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 427.2, 427.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-427.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-427.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-427.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-427.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-427.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-427.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-427.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-427.2
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '841', userid = '1', storedetaildate = '2026-10-19 10:09:31' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '10', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '831', '841', '1', '2026-10-09 17:28:12','0','0'); -- id=4767
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 = 2135;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-19', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0,40,0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-470, sellCostMeanBuyPrice = sellCostMeanBuyPrice-470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-470
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-40
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-480, sellCostBuyPrice =sellCostBuyPrice-470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-470, sellCostMeanBuyPrice = sellCostMeanBuyPrice-470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-470
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '1425', userid = '1', storedetaildate = '2026-10-19 10:09:31' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '40', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '1385', '1425', '1', '2026-10-09 17:28:12','0','0'); -- id=4768
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-22 where id = 136;
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 = 2136;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-19', 621.25, 616, 616
                    , 616, 616, 616, 616
                    , 0, 0, 0, 0
                    , 0, 0, 0,35,0, 616, 616, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-621.25, sellCostBuyPrice =sellCostBuyPrice-616
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-616, sellCostMeanBuyPrice = sellCostMeanBuyPrice-616
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-616, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-616
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-616
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-616
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-616
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-35
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 621.25, 616, 616
                    , 616, 616, 616, 616
                    , 0, 0, 0, 0
                    , 0, 0, 0, 616, 616, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-621.25, sellCostBuyPrice =sellCostBuyPrice-616
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-616, sellCostMeanBuyPrice = sellCostMeanBuyPrice-616
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-616, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-616
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-616
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-616
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-616
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '306', userid = '1', storedetaildate = '2026-10-19 10:09:31' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '35', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '271', '306', '1', '2026-10-09 17:28:12','0','0'); -- id=4769
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-26 where id = 135;
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 2137;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-19', 461.5, 457.6, 457.6
                    , 457.6, 457.6, 457.6, 457.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,26,0, 457.6, 457.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-461.5, sellCostBuyPrice =sellCostBuyPrice-457.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-457.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-457.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-457.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-457.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-457.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-457.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-457.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-26
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 461.5, 457.6, 457.6
                    , 457.6, 457.6, 457.6, 457.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 457.6, 457.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-461.5, sellCostBuyPrice =sellCostBuyPrice-457.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-457.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-457.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-457.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-457.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-457.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-457.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-457.6
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '420', userid = '1', storedetaildate = '2026-10-19 10:09:31' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '26', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '394', '420', '1', '2026-10-09 17:28:12','0','0'); -- id=4770
UPDATE sellbilldetail SET  lastbuyprice = 35.00 , meanbuyprice = 35.00, lastbuyprice_withDiscount = 35.00, meanbuyprice_withDiscount = 35.00
        , lastbuyprice_withTax = 35, meanbuyprice_withTax = 35, lastbuyprice_withDiscountAndTax = 35
                where sellbilldetailid = 2138;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (297, '2026-10-19', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-40, sellCostBuyPrice =sellCostBuyPrice-35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-40, sellCostBuyPrice =sellCostBuyPrice-35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-35, sellCostMeanBuyPrice = sellCostMeanBuyPrice-35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-35
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-19 10:09:32' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '1', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '7', '8', '1', '2026-10-09 17:28:12','0','0'); -- id=4771
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 21;
UPDATE sellbilldetail SET  lastbuyprice = 29.45 , meanbuyprice = 29.64, lastbuyprice_withDiscount = 29.45, meanbuyprice_withDiscount = 29.64
        , lastbuyprice_withTax = 29.45, meanbuyprice_withTax = 29.64, lastbuyprice_withDiscountAndTax = 29.45
                where sellbilldetailid = 2139;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (347, '2026-10-19', 31, 29.45, 29.45
                    , 29.64, 29.45, 29.64, 29.66
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 29.45, 29.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-31, sellCostBuyPrice =sellCostBuyPrice-29.45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-29.45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-29.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-29.45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-29.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-29.66
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-29.45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-29.64
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 31, 29.45, 29.45
                    , 29.64, 29.45, 29.64, 29.66
                    , 0, 0, 0, 0
                    , 0, 0, 0, 29.45, 29.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-31, sellCostBuyPrice =sellCostBuyPrice-29.45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-29.45, sellCostMeanBuyPrice = sellCostMeanBuyPrice-29.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-29.45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-29.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-29.66
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-29.45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-29.64
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '37', userid = '1', storedetaildate = '2026-10-19 10:09:32' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '1', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '36', '37', '1', '2026-10-09 17:28:12','0','0'); -- id=4772
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-8 where id = 23;
UPDATE sellbilldetail SET  lastbuyprice = 101.00 , meanbuyprice = 101.00, lastbuyprice_withDiscount = 101.00, meanbuyprice_withDiscount = 101.00
        , lastbuyprice_withTax = 101, meanbuyprice_withTax = 101, lastbuyprice_withDiscountAndTax = 101
                where sellbilldetailid = 2140;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (107, '2026-10-19', 824, 808, 808
                    , 808, 808, 808, 808
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 808, 808, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-824, sellCostBuyPrice =sellCostBuyPrice-808
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-808, sellCostMeanBuyPrice = sellCostMeanBuyPrice-808
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-808, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-808
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-808
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-808
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-808
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 824, 808, 808
                    , 808, 808, 808, 808
                    , 0, 0, 0, 0
                    , 0, 0, 0, 808, 808, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-824, sellCostBuyPrice =sellCostBuyPrice-808
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-808, sellCostMeanBuyPrice = sellCostMeanBuyPrice-808
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-808, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-808
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-808
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-808
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-808
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-19 10:09:32' WHERE storedetailid = '107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('107', '1', '8', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '63', '71', '1', '2026-10-09 17:28:12','0','0'); -- id=4773
UPDATE sellbilldetail SET  lastbuyprice = 108.50 , meanbuyprice = 108.00, lastbuyprice_withDiscount = 108.50, meanbuyprice_withDiscount = 108.00
        , lastbuyprice_withTax = 108.5, meanbuyprice_withTax = 108, lastbuyprice_withDiscountAndTax = 108.5
                where sellbilldetailid = 2141;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (110, '2026-10-19', 440, 434, 434
                    , 432, 434, 432, 434
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 434, 432, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-440, sellCostBuyPrice =sellCostBuyPrice-434
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-434, sellCostMeanBuyPrice = sellCostMeanBuyPrice-432
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-434, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-432
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-434
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-434
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-432
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 440, 434, 434
                    , 432, 434, 432, 434
                    , 0, 0, 0, 0
                    , 0, 0, 0, 434, 432, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-440, sellCostBuyPrice =sellCostBuyPrice-434
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-434, sellCostMeanBuyPrice = sellCostMeanBuyPrice-432
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-434, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-432
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-434
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-434
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-432
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2026-10-19 10:09:32' WHERE storedetailid = '110';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('110', '1', '4', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '34', '1', '2026-10-09 17:28:12','0','0'); -- id=4774
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 178;
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 2142;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (112, '2026-10-19', 240, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-240, sellCostBuyPrice =sellCostBuyPrice-232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-232, sellCostMeanBuyPrice = sellCostMeanBuyPrice-232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-232
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 240, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-240, sellCostBuyPrice =sellCostBuyPrice-232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-232, sellCostMeanBuyPrice = sellCostMeanBuyPrice-232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-232
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-19 10:09:32' WHERE storedetailid = '112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '1', '2', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '14', '16', '1', '2026-10-09 17:28:12','0','0'); -- id=4775
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2143;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 57, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-57, sellCostBuyPrice =sellCostBuyPrice-54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-54, sellCostMeanBuyPrice = sellCostMeanBuyPrice-54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-54
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 57, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-57, sellCostBuyPrice =sellCostBuyPrice-54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-54, sellCostMeanBuyPrice = sellCostMeanBuyPrice-54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-54
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-10-19 10:09:32' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '3', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '61', '1', '2026-10-09 17:28:12','0','0'); -- id=4776
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 2144;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '13', userid = '1', storedetaildate = '2026-10-19 10:09:32' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '12', '13', '1', '2026-10-09 17:28:12','0','0'); -- id=4777
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 88;
UPDATE sellbilldetail SET  lastbuyprice = 51.77 , meanbuyprice = 51.96, lastbuyprice_withDiscount = 51.77, meanbuyprice_withDiscount = 51.96
        , lastbuyprice_withTax = 51.77, meanbuyprice_withTax = 51.96, lastbuyprice_withDiscountAndTax = 51.77
                where sellbilldetailid = 2145;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (116, '2026-10-19', 224, 207.08, 207.08
                    , 207.84, 207.08, 207.84, 207.08
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 207.08, 207.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-224, sellCostBuyPrice =sellCostBuyPrice-207.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-207.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice-207.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-207.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-207.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-207.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-207.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-207.84
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 224, 207.08, 207.08
                    , 207.84, 207.08, 207.84, 207.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 207.08, 207.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-224, sellCostBuyPrice =sellCostBuyPrice-207.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-207.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice-207.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-207.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-207.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-207.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-207.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-207.84
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-19 10:09:32' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '4', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '47', '51', '1', '2026-10-09 17:28:12','0','0'); -- id=4778
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-4 where id = 119;
UPDATE sellbilldetail SET  lastbuyprice = 72.96 , meanbuyprice = 72.96, lastbuyprice_withDiscount = 72.96, meanbuyprice_withDiscount = 72.96
        , lastbuyprice_withTax = 72.96, meanbuyprice_withTax = 72.96, lastbuyprice_withDiscountAndTax = 72.96
                where sellbilldetailid = 2146;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (553, '2026-10-19', 304, 291.84, 291.84
                    , 291.84, 291.84, 291.84, 291.84
                    , 0, 0, 0, 0
                    , 0, 0, 0,4,0, 291.84, 291.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-304, sellCostBuyPrice =sellCostBuyPrice-291.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-291.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice-291.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-291.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-291.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-291.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-291.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-291.84
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-4
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 304, 291.84, 291.84
                    , 291.84, 291.84, 291.84, 291.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 291.84, 291.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-304, sellCostBuyPrice =sellCostBuyPrice-291.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-291.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice-291.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-291.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-291.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-291.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-291.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-291.84
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-19 10:09:32' WHERE storedetailid = '553';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('553', '1', '4', '0', '257', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '7', '1', '2026-10-09 17:28:12','0','0'); -- id=4779
CALL clientInUse(47,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-1300', userid = '1' WHERE clientid = '47';
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 ('47','1375.75','2675.75','1','تعديل فاتورة مبيعات','257', '-1300', '2026-10-09 17:28:12', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '4375.75', '0', null, '0', null, null,'', '0','1','1','2675.75','1','2026-10-09 17:28:12','0','0','',''); -- id=569
UPDATE client SET  inUse = 0 where clientid = 47;
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-841547.8125',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-839847.8125','1700', '1', '1', 'تعديل فاتورة مبيعات', '257', '-841547.8125', '2026-10-19 10:09:33', '1',  'sellbillController.php','47','','0'); -- id=353
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 4375.75, 4211.17, 4211.17
                    , 4210.12, 4211.17, 4210.12, 4211.38
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4211.17, 4210.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4375.75, sellCostBuyPrice =sellCostBuyPrice-4211.17
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4211.17, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4210.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4211.17, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4210.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4211.38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4211.17
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4210.12
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-10-19', 4375.75, 4211.17, 4211.17
                    , 4210.12, 4211.17, 4210.12, 4211.38
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4211.17, 4210.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-4375.75, sellCostBuyPrice =sellCostBuyPrice-4211.17
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4211.17, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4210.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4211.17, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4210.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4211.38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4211.17
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4210.12
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 4375.75, 4211.17, 4211.17
                    , 4210.12, 4211.17, 4210.12, 4211.38, 4211.17, 4210.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-4375.75, netSellCostBuyPrice = netSellCostBuyPrice-4211.17
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-4211.17
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-4210.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-4211.17
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-4210.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-4211.38
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-4211.17
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-4210.12;

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


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

COMMIT;
BEGIN;
CALL clientInUse(47,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-09 17:28:12', '06ac903bd64ee5', '47', '-1300.00', '75.75', '0', '1', '4375.75', '4375.75', '3000', '1375.75', '1', '2026-10-09 17:28:12', '', '1', '0', 'يحي غاليه ', '1', '1', '3', '0', 'يحي غاليه ', '149', '257', 'sellbillController', '0','','','','','-1','0','0','3000','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-09','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=336
UPDATE client SET  clientdebt = '75.75', userid = '1' WHERE clientid = '47';
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 ('47','-1300.00','1375.75','0','اضافة فاتورة مبيعات (معدله)','336', '75.75', '2026-10-19 10:09:33', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '4375.75', '0', null, '0', null, null,'', '0','1','1','2675.75','1','2026-10-09 17:28:12','0','0','',''); -- id=570
UPDATE client SET  inUse = 0 where clientid = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13','00190', '336', '20', '190', '10.00', '15', '150', '0', '', '1', '2026-10-19 10:09:34', '190', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','150','0','','0','0.00','0','0','0','0'); -- id=2679
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 2679;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (190, '2026-10-19', 150, 130, 130
                    , 130, 130, 130, 130
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 130, 130, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+130
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+130, sellCostMeanBuyPrice = sellCostMeanBuyPrice+130
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+130, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+130
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+130
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+130
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+130
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 150, 130, 130
                    , 130, 130, 130, 130
                    , 0, 0, 0, 0
                    , 0, 0, 0, 130, 130, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+130
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+130, sellCostMeanBuyPrice = sellCostMeanBuyPrice+130
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+130, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+130
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+130
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+130
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+130
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '166', userid = '1', storedetaildate = '2026-10-19 10:09:34' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '10', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '176', '166', '1', '2026-10-19 10:09:34','0','0'); -- id=4780
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '336', '20', '182', '10.00', '48', '480', '0', '', '1', '2026-10-19 10:09:34', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','48','480','0','','0','0.00','0','0','0','0'); -- id=2680
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 = 2680;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-19', 480, 427.2, 427.2
                    , 427.2, 427.2, 427.2, 427.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 427.2, 427.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+427.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+427.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+427.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+427.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+427.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+427.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+427.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+427.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 480, 427.2, 427.2
                    , 427.2, 427.2, 427.2, 427.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 427.2, 427.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+427.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+427.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+427.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+427.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+427.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+427.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+427.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+427.2
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '831', userid = '1', storedetaildate = '2026-10-19 10:09:34' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '10', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '841', '831', '1', '2026-10-19 10:09:34','0','0'); -- id=4781
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+40 where id = 208;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '336', '3', '102', '40.00', '12', '480', '0', '', '1', '2026-10-19 10:09:34', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','208-40,','1','1','0','0','12','480','0','','0','0.00','0','0','0','0'); -- id=2681
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 = 2681;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-19', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+470
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+40
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 480, 470, 470
                    , 470, 470, 470, 470
                    , 0, 0, 0, 0
                    , 0, 0, 0, 470, 470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+470
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1385', userid = '1', storedetaildate = '2026-10-19 10:09:35' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '40', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '1425', '1385', '1', '2026-10-19 10:09:35','0','0'); -- id=4782
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+22 where id = 136;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '336', '3', '101', '35.00', '17.75', '621.25', '0', '', '1', '2026-10-19 10:09:35', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','136-22,','1','1','0','0','17.75','621.25','0','','0','0.00','0','0','0','0'); -- id=2682
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 = 2682;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-19', 621.25, 616, 616
                    , 616, 616, 616, 616
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 0, 616, 616, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+621.25, sellCostBuyPrice =sellCostBuyPrice+616
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+616, sellCostMeanBuyPrice = sellCostMeanBuyPrice+616
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+616, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+616
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+616
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+616
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+616
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+35
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 621.25, 616, 616
                    , 616, 616, 616, 616
                    , 0, 0, 0, 0
                    , 0, 0, 0, 616, 616, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+621.25, sellCostBuyPrice =sellCostBuyPrice+616
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+616, sellCostMeanBuyPrice = sellCostMeanBuyPrice+616
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+616, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+616
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+616
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+616
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+616
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '271', userid = '1', storedetaildate = '2026-10-19 10:09:35' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '35', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '306', '271', '1', '2026-10-19 10:09:35','0','0'); -- id=4783
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+26 where id = 135;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '336', '3', '100', '26.00', '17.75', '461.5', '0', '', '1', '2026-10-19 10:09:35', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','135-26,','1','1','0','0','17.75','461.5','0','','0','0.00','0','0','0','0'); -- id=2683
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 = 2683;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-19', 461.5, 457.6, 457.6
                    , 457.6, 457.6, 457.6, 457.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 0, 457.6, 457.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+461.5, sellCostBuyPrice =sellCostBuyPrice+457.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+457.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+457.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+457.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+457.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+457.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+457.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+457.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+26
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 461.5, 457.6, 457.6
                    , 457.6, 457.6, 457.6, 457.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 457.6, 457.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+461.5, sellCostBuyPrice =sellCostBuyPrice+457.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+457.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+457.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+457.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+457.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+457.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+457.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+457.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 = '394', userid = '1', storedetaildate = '2026-10-19 10:09:35' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '26', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '420', '394', '1', '2026-10-19 10:09:35','0','0'); -- id=4784
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35','00297', '336', '6', '297', '1.00', '40', '40', '0', '', '1', '2026-10-19 10:09:35', '297', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','40','40','0','','0','0.00','0','0','0','0'); -- id=2684
UPDATE sellbilldetail SET  lastbuyprice = 35.00 , meanbuyprice = 35.00, lastbuyprice_withDiscount = 35.00, meanbuyprice_withDiscount = 35.00
        , lastbuyprice_withTax = 35, meanbuyprice_withTax = 35, lastbuyprice_withDiscountAndTax = 35
                where sellbilldetailid = 2684;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (297, '2026-10-19', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 40, 35, 35
                    , 35, 35, 35, 35
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 35, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+35
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+35, sellCostMeanBuyPrice = sellCostMeanBuyPrice+35
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+35
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+35
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+35
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-19 10:09:36' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '1', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '8', '7', '1', '2026-10-19 10:09:36','0','0'); -- id=4785
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 21;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('29.77','00347', '336', '3', '347', '1.00', '31', '31', '0', '', '1', '2026-10-19 10:09:36', '347', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','21-1,','1','1','0','0','31','31','0','','0','0.00','0','0','0','0'); -- id=2685
UPDATE sellbilldetail SET  lastbuyprice = 29.45 , meanbuyprice = 29.64, lastbuyprice_withDiscount = 29.45, meanbuyprice_withDiscount = 29.64
        , lastbuyprice_withTax = 29.45, meanbuyprice_withTax = 29.64, lastbuyprice_withDiscountAndTax = 29.45
                where sellbilldetailid = 2685;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (347, '2026-10-19', 31, 29.45, 29.45
                    , 29.64, 29.45, 29.64, 29.66
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 29.45, 29.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31, sellCostBuyPrice =sellCostBuyPrice+29.45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29.45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29.45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29.66
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29.45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+29.64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 31, 29.45, 29.45
                    , 29.64, 29.45, 29.64, 29.66
                    , 0, 0, 0, 0
                    , 0, 0, 0, 29.45, 29.64, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31, sellCostBuyPrice =sellCostBuyPrice+29.45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29.45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29.64
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29.45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29.64
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29.66
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29.45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+29.64
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-19 10:09:36' WHERE storedetailid = '347';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('347', '1', '1', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '37', '36', '1', '2026-10-19 10:09:36','0','0'); -- id=4786
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 23;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('101','00107', '336', '3', '107', '8.00', '103', '824', '0', '', '1', '2026-10-19 10:09:36', '107', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','23-8,','1','1','0','0','103','824','0','','0','0.00','0','0','0','0'); -- id=2686
UPDATE sellbilldetail SET  lastbuyprice = 101.00 , meanbuyprice = 101.00, lastbuyprice_withDiscount = 101.00, meanbuyprice_withDiscount = 101.00
        , lastbuyprice_withTax = 101, meanbuyprice_withTax = 101, lastbuyprice_withDiscountAndTax = 101
                where sellbilldetailid = 2686;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (107, '2026-10-19', 824, 808, 808
                    , 808, 808, 808, 808
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 808, 808, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+824, sellCostBuyPrice =sellCostBuyPrice+808
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+808, sellCostMeanBuyPrice = sellCostMeanBuyPrice+808
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+808, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+808
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+808
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+808
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+808
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 824, 808, 808
                    , 808, 808, 808, 808
                    , 0, 0, 0, 0
                    , 0, 0, 0, 808, 808, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+824, sellCostBuyPrice =sellCostBuyPrice+808
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+808, sellCostMeanBuyPrice = sellCostMeanBuyPrice+808
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+808, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+808
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+808
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+808
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+808
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '1', storedetaildate = '2026-10-19 10:09:37' WHERE storedetailid = '107';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('107', '1', '8', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '71', '63', '1', '2026-10-19 10:09:37','0','0'); -- id=4787
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 192;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('108.5','00110', '336', '3', '110', '4.00', '110', '440', '0', '', '1', '2026-10-19 10:09:37', '110', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','192-4,','1','1','0','0','110','440','0','','0','0.00','0','0','0','0'); -- id=2687
UPDATE sellbilldetail SET  lastbuyprice = 108.50 , meanbuyprice = 108.00, lastbuyprice_withDiscount = 108.50, meanbuyprice_withDiscount = 108.00
        , lastbuyprice_withTax = 108.5, meanbuyprice_withTax = 108, lastbuyprice_withDiscountAndTax = 108.5
                where sellbilldetailid = 2687;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (110, '2026-10-19', 440, 434, 434
                    , 432, 434, 432, 434
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 434, 432, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+434
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+434, sellCostMeanBuyPrice = sellCostMeanBuyPrice+432
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+434, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+432
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+434
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+434
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+432
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 440, 434, 434
                    , 432, 434, 432, 434
                    , 0, 0, 0, 0
                    , 0, 0, 0, 434, 432, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+434
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+434, sellCostMeanBuyPrice = sellCostMeanBuyPrice+432
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+434, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+432
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+434
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+434
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+432
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-19 10:09:37' WHERE storedetailid = '110';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('110', '1', '4', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '34', '30', '1', '2026-10-19 10:09:37','0','0'); -- id=4788
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 178;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('116','00112', '336', '3', '112', '2.00', '120', '240', '0', '', '1', '2026-10-19 10:09:37', '112', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','178-2,','1','1','0','0','120','240','0','','0','0.00','0','0','0','0'); -- id=2688
UPDATE sellbilldetail SET  lastbuyprice = 116.00 , meanbuyprice = 116.00, lastbuyprice_withDiscount = 116.00, meanbuyprice_withDiscount = 116.00
        , lastbuyprice_withTax = 116, meanbuyprice_withTax = 116, lastbuyprice_withDiscountAndTax = 116
                where sellbilldetailid = 2688;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (112, '2026-10-19', 240, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, sellCostBuyPrice =sellCostBuyPrice+232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+232, sellCostMeanBuyPrice = sellCostMeanBuyPrice+232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+232
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 240, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+240, sellCostBuyPrice =sellCostBuyPrice+232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+232, sellCostMeanBuyPrice = sellCostMeanBuyPrice+232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+232
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2026-10-19 10:09:37' WHERE storedetailid = '112';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('112', '1', '2', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '16', '14', '1', '2026-10-19 10:09:37','0','0'); -- id=4789
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '336', '14', '81', '3.00', '19', '57', '0', '', '1', '2026-10-19 10:09:37', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','57','0','','0','0.00','0','0','0','0'); -- id=2689
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2689;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 57, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57, sellCostBuyPrice =sellCostBuyPrice+54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 57, 54, 54
                    , 54, 54, 54, 54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 54, 54, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+57, sellCostBuyPrice =sellCostBuyPrice+54
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+54, sellCostMeanBuyPrice = sellCostMeanBuyPrice+54
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+54, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+54
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 10:09:38' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '3', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '61', '58', '1', '2026-10-19 10:09:38','0','0'); -- id=4790
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '336', '6', '527', '1.00', '23', '23', '0', '', '1', '2026-10-19 10:09:38', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=2690
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 2690;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-19 10:09:38' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '13', '12', '1', '2026-10-19 10:09:38','0','0'); -- id=4791
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 88;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('51.77','00116', '336', '3', '116', '4.00', '56', '224', '0', '', '1', '2026-10-19 10:09:38', '116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','88-4,','1','1','0','0','56','224','0','','0','0.00','0','0','0','0'); -- id=2691
UPDATE sellbilldetail SET  lastbuyprice = 51.77 , meanbuyprice = 51.96, lastbuyprice_withDiscount = 51.77, meanbuyprice_withDiscount = 51.96
        , lastbuyprice_withTax = 51.77, meanbuyprice_withTax = 51.96, lastbuyprice_withDiscountAndTax = 51.77
                where sellbilldetailid = 2691;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (116, '2026-10-19', 224, 207.08, 207.08
                    , 207.84, 207.08, 207.84, 207.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 207.08, 207.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+224, sellCostBuyPrice =sellCostBuyPrice+207.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+207.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+207.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+207.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+207.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+207.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+207.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+207.84
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 224, 207.08, 207.08
                    , 207.84, 207.08, 207.84, 207.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 207.08, 207.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+224, sellCostBuyPrice =sellCostBuyPrice+207.08
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+207.08, sellCostMeanBuyPrice = sellCostMeanBuyPrice+207.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+207.08, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+207.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+207.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+207.08
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+207.84
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '47', userid = '1', storedetaildate = '2026-10-19 10:09:38' WHERE storedetailid = '116';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('116', '1', '4', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '51', '47', '1', '2026-10-19 10:09:38','0','0'); -- id=4792
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 119;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('72.96','00553', '336', '3', '553', '4.00', '76', '304', '0', '', '1', '2026-10-19 10:09:38', '553', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','119-4,','1','1','0','0','76','304','0','','0','0.00','0','0','0','0'); -- id=2692
UPDATE sellbilldetail SET  lastbuyprice = 72.96 , meanbuyprice = 72.96, lastbuyprice_withDiscount = 72.96, meanbuyprice_withDiscount = 72.96
        , lastbuyprice_withTax = 72.96, meanbuyprice_withTax = 72.96, lastbuyprice_withDiscountAndTax = 72.96
                where sellbilldetailid = 2692;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (553, '2026-10-19', 304, 291.84, 291.84
                    , 291.84, 291.84, 291.84, 291.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 291.84, 291.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+304, sellCostBuyPrice =sellCostBuyPrice+291.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+291.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice+291.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+291.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+291.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+291.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+291.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+291.84
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 304, 291.84, 291.84
                    , 291.84, 291.84, 291.84, 291.84
                    , 0, 0, 0, 0
                    , 0, 0, 0, 291.84, 291.84, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+304, sellCostBuyPrice =sellCostBuyPrice+291.84
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+291.84, sellCostMeanBuyPrice = sellCostMeanBuyPrice+291.84
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+291.84, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+291.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+291.84
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+291.84
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+291.84
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-19 10:09:39' WHERE storedetailid = '553';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('553', '1', '4', '1', '336', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '7', '3', '1', '2026-10-19 10:09:39','0','0'); -- id=4793
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-838547.8125',  userid = '1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-841547.8125','3000', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '336', '-838547.8125', '2026-10-19 10:09:39', '1',  'sellbillController.php','47','','0'); -- id=354
UPDATE dailyentry SET totalcreditor = '4375.75', totaldebtor = '4375.75', thedate = '2026-10-09', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 17:29:21', entryComment = 'اضافة فاتورة مبيعات رقم 257', fromFlag = '1',related='0',isopeningentry='0',operationId='257',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=257' WHERE id = '1463';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4375.75', '4375.75', '2026-10-19', '1', '0', '1463', '2026-10-19 10:09:39','تم عكس القيد رقم 1463 ','1','0','0','0','0',''); -- id=1744
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1744', '480', '4375.75', '','0'); -- id=1748
UPDATE accountstree SET name = 'يحي غاليه ', customName = 'يحي غاليه ', customNameEn = 'يحي غاليه ', nameEn = 'يحي غاليه ', parent = '58', accountNature = '0', theValue = '-3000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 17:10:16' WHERE id = '480';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1744', '143', '4375.75', '','0'); -- id=1760
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1483849.58', 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 = '1700.00', totaldebtor = '1700.00', thedate = '2026-10-09', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 17:29:21', entryComment = 'اضافة فاتورة مبيعات رقم 257 - تحصيل الفاتورة من العميل', fromFlag = '1',related='0',isopeningentry='0',operationId='257',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=257' WHERE id = '1464';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1700.00', '1700.00', '2026-10-19', '1', '0', '1464', '2026-10-19 10:09:40','تم عكس القيد رقم 1464 ','1','0','0','0','0',''); -- id=1745
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1745', '383', '1700.00', '','0'); -- id=1749
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '141917.02', 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 ('1745', '480', '1700.00', '','0'); -- id=1761
UPDATE accountstree SET name = 'يحي غاليه ', customName = 'يحي غاليه ', customNameEn = 'يحي غاليه ', nameEn = 'يحي غاليه ', parent = '58', accountNature = '0', theValue = '-1300', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 17:10:16' WHERE id = '480';
UPDATE dailyentry SET totalcreditor = '4201.17', totaldebtor = '4201.17', thedate = '2026-10-09', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-09 17:29:21', entryComment = 'اضافة فاتورة مبيعات رقم 257 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='257',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=257' WHERE id = '1465';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4201.17', '4201.17', '2026-10-19', '1', '0', '1465', '2026-10-19 10:09:40','تم عكس القيد رقم 1465 ','1','0','0','0','0',''); -- id=1746
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1746', '402', '4201.17', '','0'); -- id=1750
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1324837.16', 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 ('1746', '382', '4201.17', '','0'); -- id=1762
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2221356.94', 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 ( '4375.75', '4375.75', '2026-10-19', '1', '0', '0', '2026-10-19 10:09:40','اضافة فاتورة مبيعات رقم 336','1','0',null,'0','336','sellbillController.php?do=showDetail&sellbillid=336'); -- id=1747
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1747', '480', '4375.75', '','0'); -- id=1763
UPDATE accountstree SET name = 'يحي غاليه ', customName = 'يحي غاليه ', customNameEn = 'يحي غاليه ', nameEn = 'يحي غاليه ', parent = '58', accountNature = '0', theValue = '3075.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 17:10:16' WHERE id = '480';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1747', '143', '4375.75', '','0'); -- id=1751
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1488225.33', 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 ( '3000', '3000', '2026-10-19', '1', '0', '0', '2026-10-19 10:09:40','اضافة فاتورة مبيعات رقم 336 - تحصيل الفاتورة من العميل','1','0',null,'0','336','sellbillController.php?do=showDetail&sellbillid=336'); -- id=1748
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1748', '383', '3000', '','0'); -- id=1764
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '144917.02', 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 ('1748', '480', '3000', '','0'); -- id=1752
UPDATE accountstree SET name = 'يحي غاليه ', customName = 'يحي غاليه ', customNameEn = 'يحي غاليه ', nameEn = 'يحي غاليه ', parent = '58', accountNature = '0', theValue = '75.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 17:10:16' WHERE id = '480';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4211.17', '4211.17', '2026-10-19', '1', '0', '0', '2026-10-19 10:09:40','اضافة فاتورة مبيعات رقم 336 - صرف البضاعة من المخزن','1','0',null,'0','336','sellbillController.php?do=showDetail&sellbillid=336'); -- id=1749
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1749', '402', '4211.17', '','0'); -- id=1765
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1329048.33', 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 ('1749', '382', '4211.17', '','0'); -- id=1753
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2217145.77', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1747,1748,1749' where sellbillid=336;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 4375.75, 4211.17, 4211.17
                    , 4210.12, 4211.17, 4210.12, 4211.38
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4211.17, 4210.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4375.75, sellCostBuyPrice =sellCostBuyPrice+4211.17
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4211.17, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4210.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4211.17, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4210.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4211.38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4211.17
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4210.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (47, '2026-10-19', 4375.75, 4211.17, 4211.17
                    , 4210.12, 4211.17, 4210.12, 4211.38
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4211.17, 4210.12, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4375.75, sellCostBuyPrice =sellCostBuyPrice+4211.17
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4211.17, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4210.12
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4211.17, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4210.12
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4211.38
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4211.17
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4210.12
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 4375.75, 4211.17, 4211.17
                    , 4210.12, 4211.17, 4210.12, 4211.38, 4211.17, 4210.12)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4375.75, netSellCostBuyPrice = netSellCostBuyPrice+4211.17
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4211.17
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4210.12
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4211.17
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4210.12
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4211.38
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4211.17
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4210.12;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 257 and newid=336 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:39:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:09:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:09:42', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=336'); -- id=4540
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:40:01";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:10:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:10:01', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4541
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:40:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:10:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:10:08', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4542
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:40:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:10:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:10:28', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=336'); -- id=4543
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:40:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:10:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:10:43', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4544
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:41:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:11:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 10:11:27', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4545
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:41:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:11:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 10:11:41', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4546

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =571
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(47,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-19 10:11:42', userid = '1' WHERE clientid = '47';
UPDATE client SET  inUse = 0 where clientid = 47;
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 ('47','75.75','75.75','1','ايصال تحصيل (( قبض من عميل ))','571', '0', '2026-10-19 10:11:27', '1', 'clientPayedDeptController.php', '   ', '75.75', '0', null, '0', null, null,'', '-1','1','1','75.75','1','','60','0','','.'); -- id=571
UPDATE save SET  savecurrentvalue = '-838472.06',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-838547.81','75.75', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '571', '-838472.06', '2026-10-19 10:11:42', '1',  'clientPayedDeptController.php','47','','0'); -- id=355
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '75.75', '75.75', '2026-10-19', '1', '0', '0', '2026-10-19 10:11:42','اضافة ايصال سداد للعميل يحي غاليه ','1','0','0','0','571','clientPayedDeptController.php?do=show&id=571'); -- id=1750
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1750', '383', '75.75', '','0'); -- id=1766
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '144992.77', 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 ('1750', '480', '75.75', '','0'); -- id=1754
UPDATE accountstree SET name = 'يحي غاليه ', customName = 'يحي غاليه ', customNameEn = 'يحي غاليه ', nameEn = 'يحي غاليه ', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 17:10:16' WHERE id = '480';
UPDATE clientdebtchange SET clientid = '47', clientdebtchangebefore = '75.750', clientdebtchangeamount = '75.750', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '571', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-19 10:11:27', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '75.750',discount='', reciptid='0', dailyentryid = '1750',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='75.75',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '571';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:41:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:11:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 10:11:43', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4547
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:41:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:11:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 10:11:45', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4548
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:42:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:12:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:12:09', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4549
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:43:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:13:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:13:18', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4550
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:43:25";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:13:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:13:25', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4551
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:43:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:13:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:13:39', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=336'); -- id=4552
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 06:43:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 10:13:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 10:13:56', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4553
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 07:46:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:16:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 11:16:38', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4554
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 07:50:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:20:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 11:20:08', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4555

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad5dff73edf7
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 11:20:08', '06ad5dff73edf7', '1', '0.00', '0', '0', '1', '5090.00', '5090', '5090', '0', '1', '2026-10-19 11:20:08', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '264' ,'0','','','','','-1','0','0','0','0','0','5090','0','','0','0','5090','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=337
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','اضافة فاتورة مبيعات','337', '0', '2026-10-19 11:20:09', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5090', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 11:20:08','0','0','',''); -- id=572
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '337', '6', '207', '10', '15', '150', '0', '', '1', '2026-10-19 11:20:09', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','150','0','','0','0.00','0','0','0','0'); -- id=2693
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2693;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-19', 150, 110, 110
                    , 110, 110, 110, 110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 110, 110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 150, 110, 110
                    , 110, 110, 110, 110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 110, 110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-10-19 11:20:09' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '10', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '78', '68', '1', '2026-10-19 11:20:09','0','0'); -- id=4794
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+33 where id = 93;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+27 where id = 203;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '337', '4', '279', '60', '12.75', '765', '0', '', '1', '2026-10-19 11:20:10', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','93-33,203-27,','1','1','0','0','12.75','765','0','','0','0.00','0','0','0','0'); -- id=2694
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 = 2694;
 INSERT INTO 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-10-19', 765, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+765, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+60
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 765, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+765, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '181', userid = '1', storedetaildate = '2026-10-19 11:20:10' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '60', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '241', '181', '1', '2026-10-19 11:20:10','0','0'); -- id=4795
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+60 where id = 92;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13.8','00280', '337', '4', '280', '60', '12.75', '765', '0', '', '1', '2026-10-19 11:20:10', '280', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','92-60,','1','1','0','0','12.75','765','0','','0','0.00','0','0','0','0'); -- id=2695
UPDATE sellbilldetail SET  lastbuyprice = 13.80 , meanbuyprice = 13.80, lastbuyprice_withDiscount = 13.80, meanbuyprice_withDiscount = 13.80
        , lastbuyprice_withTax = 13.8, meanbuyprice_withTax = 13.8, lastbuyprice_withDiscountAndTax = 13.8
                where sellbilldetailid = 2695;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (280, '2026-10-19', 765, 828, 828
                    , 828, 828, 828, 828
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 828, 828, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+765, sellCostBuyPrice =sellCostBuyPrice+828
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+828, sellCostMeanBuyPrice = sellCostMeanBuyPrice+828
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+828, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+828
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+828
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+828
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+828
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+60
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 765, 828, 828
                    , 828, 828, 828, 828
                    , 0, 0, 0, 0
                    , 0, 0, 0, 828, 828, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+765, sellCostBuyPrice =sellCostBuyPrice+828
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+828, sellCostMeanBuyPrice = sellCostMeanBuyPrice+828
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+828, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+828
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+828
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+828
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+828
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '120', userid = '1', storedetaildate = '2026-10-19 11:20:10' WHERE storedetailid = '280';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('280', '1', '60', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '180', '120', '1', '2026-10-19 11:20:10','0','0'); -- id=4796
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+60 where id = 204;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00368', '337', '4', '368', '60', '8', '480', '0', '', '1', '2026-10-19 11:20:10', '368', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','204-60,','1','1','0','0','8','480','0','','0','0.00','0','0','0','0'); -- id=2696
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.00, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.00
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 2696;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (368, '2026-10-19', 480, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+60
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 480, 420, 420
                    , 420, 420, 420, 420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 420, 420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '339', userid = '1', storedetaildate = '2026-10-19 11:20:11' WHERE storedetailid = '368';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('368', '1', '60', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '399', '339', '1', '2026-10-19 11:20:11','0','0'); -- id=4797
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.5','00372', '337', '4', '372', '60', '12', '720', '0', '', '1', '2026-10-19 11:20:11', '372', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','12','720','0','','0','0.00','0','0','0','0'); -- id=2697
UPDATE sellbilldetail SET  lastbuyprice = 10.50 , meanbuyprice = 10.50, lastbuyprice_withDiscount = 10.50, meanbuyprice_withDiscount = 10.50
        , lastbuyprice_withTax = 10.5, meanbuyprice_withTax = 10.5, lastbuyprice_withDiscountAndTax = 10.5
                where sellbilldetailid = 2697;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (372, '2026-10-19', 720, 630, 630
                    , 630, 630, 630, 630
                    , 0, 0, 0, 0
                    , 0, 0, 0, 60, 0, 630, 630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+630, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+630
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+630
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+630
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+60
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 720, 630, 630
                    , 630, 630, 630, 630
                    , 0, 0, 0, 0
                    , 0, 0, 0, 630, 630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+720, sellCostBuyPrice =sellCostBuyPrice+630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+630, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+630
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+630
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+630
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '110', userid = '1', storedetaildate = '2026-10-19 11:20:11' WHERE storedetailid = '372';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('372', '1', '60', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '170', '110', '1', '2026-10-19 11:20:11','0','0'); -- id=4798
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 114;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1350','00230', '337', '10', '230', '1', '1650', '1650', '0', '', '1', '2026-10-19 11:20:11', '230', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','114-1,','1','1','0','0','1650','1650','0','','0','0.00','0','0','0','0'); -- id=2698
UPDATE sellbilldetail SET  lastbuyprice = 1350.00 , meanbuyprice = 1336.36, lastbuyprice_withDiscount = 1350.00, meanbuyprice_withDiscount = 1336.36
        , lastbuyprice_withTax = 1350, meanbuyprice_withTax = 1336.36, lastbuyprice_withDiscountAndTax = 1350
                where sellbilldetailid = 2698;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (230, '2026-10-19', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1336.36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1650, 1350, 1350
                    , 1336.36, 1350, 1336.36, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1336.36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1336.36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1336.36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1336.36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-19 11:20:11' WHERE storedetailid = '230';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('230', '1', '1', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '8', '1', '2026-10-19 11:20:11','0','0'); -- id=4799
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('60','00298', '337', '6', '298', '3', '75', '225', '0', '', '1', '2026-10-19 11:20:11', '298', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','75','225','0','','0','0.00','0','0','0','0'); -- id=2699
UPDATE sellbilldetail SET  lastbuyprice = 60.00 , meanbuyprice = 60.00, lastbuyprice_withDiscount = 60.00, meanbuyprice_withDiscount = 60.00
        , lastbuyprice_withTax = 60, meanbuyprice_withTax = 60, lastbuyprice_withDiscountAndTax = 60
                where sellbilldetailid = 2699;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (298, '2026-10-19', 225, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 225, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '-2', userid = '1', storedetaildate = '2026-10-19 11:20:12' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '3', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '-2', '1', '2026-10-19 11:20:12','0','0'); -- id=4800
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35','00079', '337', '22', '79', '5', '39', '195', '0', '', '1', '2026-10-19 11:20:12', '79', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','39','195','0','','0','0.00','0','0','0','0'); -- id=2700
UPDATE sellbilldetail SET  lastbuyprice = 35.00 , meanbuyprice = 35.00, lastbuyprice_withDiscount = 35.00, meanbuyprice_withDiscount = 35.00
        , lastbuyprice_withTax = 35, meanbuyprice_withTax = 35, lastbuyprice_withDiscountAndTax = 35
                where sellbilldetailid = 2700;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (79, '2026-10-19', 195, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 195, 175, 175
                    , 175, 175, 175, 175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 175, 175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, sellCostBuyPrice =sellCostBuyPrice+175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '1', storedetaildate = '2026-10-19 11:20:12' WHERE storedetailid = '79';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('79', '1', '5', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '7', '1', '2026-10-19 11:20:12','0','0'); -- id=4801
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 99;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('24.8','00291', '337', '24', '291', '5', '28', '140', '0', '', '1', '2026-10-19 11:20:12', '291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','99-5,','1','1','0','0','28','140','0','','0','0.00','0','0','0','0'); -- id=2701
UPDATE sellbilldetail SET  lastbuyprice = 25.60 , meanbuyprice = 25.21, lastbuyprice_withDiscount = 25.60, meanbuyprice_withDiscount = 25.21
        , lastbuyprice_withTax = 25.6, meanbuyprice_withTax = 25.21, lastbuyprice_withDiscountAndTax = 25.6
                where sellbilldetailid = 2701;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (291, '2026-10-19', 140, 128, 128
                    , 126.05, 128, 126.05, 125.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 128, 126.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+128
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+128, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+128, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+125.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+128
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126.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+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 140, 128, 128
                    , 126.05, 128, 126.05, 125.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 128, 126.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+140, sellCostBuyPrice =sellCostBuyPrice+128
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+128, sellCostMeanBuyPrice = sellCostMeanBuyPrice+126.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+128, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+126.05
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+125.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+128
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+126.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 = '102', userid = '1', storedetaildate = '2026-10-19 11:20:12' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '5', '1', '337', 'اضافة فاتورة مبيعات', 'sellbillController.php', '107', '102', '1', '2026-10-19 11:20:12','0','0'); -- id=4802
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-833382.0625',  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 ('-838472.0625','5090', '0', '1', 'اضافة فاتورة مبيعات', '337', '-833382.0625', '2026-10-19 11:20:12', '1',  'sellbillController.php','1','','0'); -- id=356
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5090', '5090', '2026-10-19', '1', '0', '0', '2026-10-19 11:20:13','اضافة فاتورة مبيعات رقم 337','1','0',null,'0','337','sellbillController.php?do=showDetail&sellbillid=337'); -- id=1751
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1751', '383', '5090', '','0'); -- id=1767
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '150082.77', 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 ('1751', '143', '5090', '','0'); -- id=1755
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1493315.33', 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 ( '4661', '4661', '2026-10-19', '1', '0', '0', '2026-10-19 11:20:13','اضافة فاتورة مبيعات رقم 337 - صرف البضاعة من المخزن','1','0',null,'0','337','sellbillController.php?do=showDetail&sellbillid=337'); -- id=1752
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1752', '402', '4661', '','0'); -- id=1768
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1333709.33', 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 ('1752', '382', '4661', '','0'); -- id=1756
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2212484.77', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1751,0,1752' where sellbillid=337;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 5090, 4661, 4661
                    , 4645.41, 4661, 4645.41, 4658.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4661, 4645.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5090, sellCostBuyPrice =sellCostBuyPrice+4661
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4661, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4645.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4661, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4645.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4658.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4661
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4645.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 5090, 4661, 4661
                    , 4645.41, 4661, 4645.41, 4658.7
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4661, 4645.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5090, sellCostBuyPrice =sellCostBuyPrice+4661
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4661, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4645.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4661, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4645.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4658.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4661
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4645.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5090, 4661, 4661
                    , 4645.41, 4661, 4645.41, 4658.7, 4661, 4645.41)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5090, netSellCostBuyPrice = netSellCostBuyPrice+4661
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4661
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4645.41
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4661
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4645.41
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4658.7
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4661
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4645.41;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad5dff73edf7 and sellbillId = 337 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 07:50:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:20:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 11:20:14', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4556
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:10:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:40:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-19 11:40:00', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4557
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:10:10";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:40:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-19 11:40:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4558
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:10:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:40:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 11:40:19', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4559
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:10:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:40:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 11:40:28', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4560
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:10:39";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:40:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 11:40:39', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4561

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad5d0da49d46
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(47,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 11:40:39', '06ad5d0da49d46', '47', '0.00', '760', '0', '1', '760.00', '760', '0', '760', '1', '2026-10-19 11:40:39', '', '1', '0', 'يحي غاليه ', '1', '1', '3', '0', 'يحي غاليه ', '106' ,'0','','','','','-1','0','0','0','0','0','760','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=338
UPDATE client SET  clientdebt = '760', userid = '1' WHERE clientid = '47';
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 ('47','0.00','760','0','اضافة فاتورة مبيعات','338', '760', '2026-10-19 11:40:40', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '760', '0', null, '0', null, null,'', '0','1','1','760','1','2026-10-19 11:40:39','0','0','',''); -- id=573
UPDATE client SET  inUse = 0 where clientid = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('37','00117', '338', '3', '117', '6', '35', '210', '0', '', '1', '2026-10-19 11:40:40', '117', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','35','210','0','','0','0.00','0','0','0','0'); -- id=2702
UPDATE sellbilldetail SET  lastbuyprice = 37.00 , meanbuyprice = 37.00, lastbuyprice_withDiscount = 37.00, meanbuyprice_withDiscount = 37.00
        , lastbuyprice_withTax = 37, meanbuyprice_withTax = 37, lastbuyprice_withDiscountAndTax = 37
                where sellbilldetailid = 2702;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (117, '2026-10-19', 210, 222, 222
                    , 222, 222, 222, 222
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 222, 222, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, sellCostBuyPrice =sellCostBuyPrice+222
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+222, sellCostMeanBuyPrice = sellCostMeanBuyPrice+222
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+222, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+222
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+222
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+222
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+222
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 210, 222, 222
                    , 222, 222, 222, 222
                    , 0, 0, 0, 0
                    , 0, 0, 0, 222, 222, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+210, sellCostBuyPrice =sellCostBuyPrice+222
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+222, sellCostMeanBuyPrice = sellCostMeanBuyPrice+222
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+222, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+222
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+222
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+222
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+222
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-19 11:40:40' WHERE storedetailid = '117';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('117', '1', '6', '1', '338', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '10', '1', '2026-10-19 11:40:40','0','0'); -- id=4803
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+100 where id = 199;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '338', '3', '103', '100', '5.5', '550', '0', '', '1', '2026-10-19 11:40:41', '103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','199-100,','1','1','0','0','5.5','550','0','','0','0.00','0','0','0','0'); -- id=2703
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 = 2703;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (103, '2026-10-19', 550, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+550, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+100
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 550, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+550, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1050', userid = '1', storedetaildate = '2026-10-19 11:40:41' WHERE storedetailid = '103';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('103', '1', '100', '1', '338', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1150', '1050', '1', '2026-10-19 11:40:41','0','0'); -- id=4804
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '760', '760', '2026-10-19', '1', '0', '0', '2026-10-19 11:40:41','اضافة فاتورة مبيعات رقم 338','1','0',null,'0','338','sellbillController.php?do=showDetail&sellbillid=338'); -- id=1753
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1753', '480', '760', '','0'); -- id=1769
UPDATE accountstree SET name = 'يحي غاليه ', customName = 'يحي غاليه ', customNameEn = 'يحي غاليه ', nameEn = 'يحي غاليه ', parent = '58', accountNature = '0', theValue = '760', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 17:10:16' WHERE id = '480';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1753', '143', '760', '','0'); -- id=1757
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1494075.33', 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 ( '672', '672', '2026-10-19', '1', '0', '0', '2026-10-19 11:40:41','اضافة فاتورة مبيعات رقم 338 - صرف البضاعة من المخزن','1','0',null,'0','338','sellbillController.php?do=showDetail&sellbillid=338'); -- id=1754
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1754', '402', '672', '','0'); -- id=1770
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1334381.33', 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 ('1754', '382', '672', '','0'); -- id=1758
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2211812.77', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1753,0,1754' where sellbillid=338;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 760, 672, 672
                    , 672, 672, 672, 672
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,672, 672, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+672
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+672, sellCostMeanBuyPrice = sellCostMeanBuyPrice+672
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+672, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+672
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+672
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+672
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+672
                        , returnSellVal = returnSellVal+0, 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 (47, '2026-10-19', 760, 672, 672
                    , 672, 672, 672, 672
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,672, 672, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+672
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+672, sellCostMeanBuyPrice = sellCostMeanBuyPrice+672
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+672, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+672
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+672
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+672
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+672
                        , returnSellVal = returnSellVal+0, 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, 760, 672, 672
                    , 672, 672, 672, 672, 672, 672)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+760, netSellCostBuyPrice = netSellCostBuyPrice+672
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+672
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+672
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+672
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+672
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+672
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+672
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+672;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad5d0da49d46 and sellbillId = 338 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:10:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 11:40:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 11:40:42', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4562
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:37:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 12:07:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 12:07:44', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4563
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:38:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 12:08:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 12:08:05', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4564

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad5ebf118543
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(9,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 12:08:06', '06ad5ebf118543', '9', '4798.75', '5728.75', '0', '1', '930.00', '930', '0', '930', '1', '2026-10-19 12:08:06', '', '1', '0', 'طارق عز', '1', '1', '3', '0', '9 - طارق عز', '10' ,'0','','','','','-1','0','0','0','0','0','930','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=339
UPDATE client SET  clientdebt = '5728.75', userid = '1' WHERE clientid = '9';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('9','4798.75','930','0','اضافة فاتورة مبيعات','339', '5728.75', '2026-10-19 12:08:06', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '930', '0', null, '0', null, null,'', '0','1','1','930','1','2026-10-19 12:08:06','0','0','',''); -- id=574
UPDATE client SET  inUse = 0 where clientid = 9;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 197;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('80','00387', '339', '7', '387', '10', '93', '930', '0', '', '1', '2026-10-19 12:08:07', '387', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','197-10,','1','1','0','0','93','930','0','','0','0.00','0','0','0','0'); -- id=2704
UPDATE sellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 79.95, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 79.95
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 79.95, lastbuyprice_withDiscountAndTax = 80
                where sellbilldetailid = 2704;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (387, '2026-10-19', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+930, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+799.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+930, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+799.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 = '16', userid = '1', storedetaildate = '2026-10-19 12:08:07' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '10', '1', '339', 'اضافة فاتورة مبيعات', 'sellbillController.php', '26', '16', '1', '2026-10-19 12:08:07','0','0'); -- id=4805
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '930', '930', '2026-10-19', '1', '0', '0', '2026-10-19 12:08:07','اضافة فاتورة مبيعات رقم 339','1','0',null,'0','339','sellbillController.php?do=showDetail&sellbillid=339'); -- id=1755
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1755', '436', '930', '','0'); -- id=1771
UPDATE accountstree SET name = 'طارق عز', customName = 'طارق عز', customNameEn = 'طارق عز', nameEn = 'طارق عز', parent = '58', accountNature = '0', theValue = '5728.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 13:28:38' WHERE id = '436';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1755', '143', '930', '','0'); -- id=1759
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1495005.33', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '800', '800', '2026-10-19', '1', '0', '0', '2026-10-19 12:08:07','اضافة فاتورة مبيعات رقم 339 - صرف البضاعة من المخزن','1','0',null,'0','339','sellbillController.php?do=showDetail&sellbillid=339'); -- id=1756
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1756', '402', '800', '','0'); -- id=1772
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1335181.33', 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 ('1756', '382', '800', '','0'); -- id=1760
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2211012.77', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1755,0,1756' where sellbillid=339;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+930, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+799.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-19', 930, 800, 800
                    , 799.5, 800, 799.5, 800
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,800, 799.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+930, sellCostBuyPrice =sellCostBuyPrice+800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+799.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+799.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+799.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, 930, 800, 800
                    , 799.5, 800, 799.5, 800, 800, 799.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+930, netSellCostBuyPrice = netSellCostBuyPrice+800
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+800
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+799.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+800
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+799.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+800
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+800
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+799.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad5ebf118543 and sellbillId = 339 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad5ec099f593
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(71,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 12:20:44', '06ad5ec099f593', '71', '0.00', '21216.97', '0', '1', '21216.97', '21216.97', '0', '21216.97', '1', '2026-10-19 12:20:44', '', '1', '0', 'ايمن فريد', '1', '1', '3', '0', 'ايمن فريد', '386' ,'0','','','','','-1','0','0','0','0','0','21216','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=340
UPDATE client SET  clientdebt = '21216.97', userid = '1' WHERE clientid = '71';
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 ('71','0.00','21216.97','0','اضافة فاتورة مبيعات','340', '21216.97', '2026-10-19 12:20:45', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '21216.97', '0', null, '0', null, null,'', '0','1','1','21216.97','1','2026-10-19 12:20:44','0','0','',''); -- id=576
UPDATE client SET  inUse = 0 where clientid = 71;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 167;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('200','00029', '340', '8', '29', '8', '265', '2120', '0', '', '1', '2026-10-19 12:20:45', '29', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','167-8,','1','1','0','0','265','2120','0','','0','0.00','0','0','0','0'); -- id=2705
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 200.00, meanbuyprice_withDiscount = 200.00
        , lastbuyprice_withTax = 200, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 200
                where sellbilldetailid = 2705;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (29, '2026-10-19', 2120, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2120, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2120, 1600, 1600
                    , 1600, 1600, 1600, 1600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1600, 1600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2120, sellCostBuyPrice =sellCostBuyPrice+1600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-19 12:20:45' WHERE storedetailid = '29';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('29', '1', '8', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '28', '20', '1', '2026-10-19 12:20:45','0','0'); -- id=4806
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('255','00032', '340', '8', '32', '7', '295', '2065', '0', '', '1', '2026-10-19 12:20:45', '32', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','295','2065','0','','0','0.00','0','0','0','0'); -- id=2706
UPDATE sellbilldetail SET  lastbuyprice = 255.00 , meanbuyprice = 255.00, lastbuyprice_withDiscount = 255.00, meanbuyprice_withDiscount = 255.00
        , lastbuyprice_withTax = 255, meanbuyprice_withTax = 255, lastbuyprice_withDiscountAndTax = 255
                where sellbilldetailid = 2706;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (32, '2026-10-19', 2065, 1785, 1785
                    , 1785, 1785, 1785, 1785
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 1785, 1785, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2065, sellCostBuyPrice =sellCostBuyPrice+1785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1785, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1785
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1785, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1785
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1785
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1785
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1785
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2065, 1785, 1785
                    , 1785, 1785, 1785, 1785
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1785, 1785, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2065, sellCostBuyPrice =sellCostBuyPrice+1785
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1785, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1785
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1785, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1785
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1785
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1785
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1785
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2026-10-19 12:20:45' WHERE storedetailid = '32';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('32', '1', '7', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '18', '1', '2026-10-19 12:20:45','0','0'); -- id=4807
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','00428', '340', '8', '428', '5', '350', '1750', '0', '', '1', '2026-10-19 12:20:45', '428', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','350','1750','0','','0','0.00','0','0','0','0'); -- id=2707
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 2707;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (428, '2026-10-19', 1750, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1750, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1750, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1750, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '31', userid = '1', storedetaildate = '2026-10-19 12:20:46' WHERE storedetailid = '428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('428', '1', '5', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '31', '1', '2026-10-19 12:20:46','0','0'); -- id=4808
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 149;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('237','00010', '340', '1', '10', '4', '246.5', '986', '0', '', '1', '2026-10-19 12:20:46', '10', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','149-4,','1','1','0','0','246.5','986','0','','0','0.00','0','0','0','0'); -- id=2708
UPDATE sellbilldetail SET  lastbuyprice = 237.00 , meanbuyprice = 237.00, lastbuyprice_withDiscount = 237.00, meanbuyprice_withDiscount = 237.00
        , lastbuyprice_withTax = 237, meanbuyprice_withTax = 237, lastbuyprice_withDiscountAndTax = 237
                where sellbilldetailid = 2708;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (10, '2026-10-19', 986, 948, 948
                    , 948, 948, 948, 948
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 948, 948, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+986, sellCostBuyPrice =sellCostBuyPrice+948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+948, sellCostMeanBuyPrice = sellCostMeanBuyPrice+948
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+948, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+948
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+948
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+948
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 986, 948, 948
                    , 948, 948, 948, 948
                    , 0, 0, 0, 0
                    , 0, 0, 0, 948, 948, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+986, sellCostBuyPrice =sellCostBuyPrice+948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+948, sellCostMeanBuyPrice = sellCostMeanBuyPrice+948
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+948, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+948
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+948
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+948
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '177', userid = '1', storedetaildate = '2026-10-19 12:20:46' WHERE storedetailid = '10';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('10', '1', '4', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '181', '177', '1', '2026-10-19 12:20:46','0','0'); -- id=4809
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 158;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','00013', '340', '1', '13', '1', '317.7', '317.7', '0', '', '1', '2026-10-19 12:20:46', '13', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','158-1,','1','1','0','0','317.7','317.7','0','','0','0.00','0','0','0','0'); -- id=2709
UPDATE sellbilldetail SET  lastbuyprice = 306.00 , meanbuyprice = 306.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 306, meanbuyprice_withTax = 306, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 2709;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (13, '2026-10-19', 317.7, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+317.7, sellCostBuyPrice =sellCostBuyPrice+306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+306, sellCostMeanBuyPrice = sellCostMeanBuyPrice+306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+306
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 317.7, 306, 306
                    , 306, 306, 306, 306
                    , 0, 0, 0, 0
                    , 0, 0, 0, 306, 306, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+317.7, sellCostBuyPrice =sellCostBuyPrice+306
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+306, sellCostMeanBuyPrice = sellCostMeanBuyPrice+306
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+306, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+306
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+306
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+306
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+306
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '96', userid = '1', storedetaildate = '2026-10-19 12:20:46' WHERE storedetailid = '13';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('13', '1', '1', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '97', '96', '1', '2026-10-19 12:20:46','0','0'); -- id=4810
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '340', '6', '207', '10', '15', '150', '0', '', '1', '2026-10-19 12:20:47', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','150','0','','0','0.00','0','0','0','0'); -- id=2710
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2710;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-19', 150, 110, 110
                    , 110, 110, 110, 110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 110, 110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 150, 110, 110
                    , 110, 110, 110, 110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 110, 110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+150, sellCostBuyPrice =sellCostBuyPrice+110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 12:20:47' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '10', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '68', '58', '1', '2026-10-19 12:20:47','0','0'); -- id=4811
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1282','00202', '340', '6', '202', '1', '1750', '1750', '0', '', '1', '2026-10-19 12:20:47', '202', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1750','1750','0','','0','0.00','0','0','0','0'); -- id=2711
UPDATE sellbilldetail SET  lastbuyprice = 1282.00 , meanbuyprice = 1271.33, lastbuyprice_withDiscount = 1282.00, meanbuyprice_withDiscount = 1271.33
        , lastbuyprice_withTax = 1282, meanbuyprice_withTax = 1271.33, lastbuyprice_withDiscountAndTax = 1282
                where sellbilldetailid = 2711;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (202, '2026-10-19', 1750, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1750, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1750, 1282, 1282
                    , 1271.33, 1282, 1271.33, 1282
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1282, 1271.33, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1750, sellCostBuyPrice =sellCostBuyPrice+1282
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1282, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1271.33
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1282, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1271.33
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1282
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1282
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1271.33
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-19 12:20:47' WHERE storedetailid = '202';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('202', '1', '1', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-10-19 12:20:47','0','0'); -- id=4812
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 161;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00006', '340', '1', '6', '3', '109', '327', '0', '', '1', '2026-10-19 12:20:47', '6', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','161-3,','1','1','0','0','109','327','0','','0','0.00','0','0','0','0'); -- id=2712
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 2712;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (6, '2026-10-19', 327, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+327, sellCostBuyPrice =sellCostBuyPrice+315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+315, sellCostMeanBuyPrice = sellCostMeanBuyPrice+315
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+315, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+315
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+315
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+315
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+315
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 327, 315, 315
                    , 315, 315, 315, 315
                    , 0, 0, 0, 0
                    , 0, 0, 0, 315, 315, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+327, sellCostBuyPrice =sellCostBuyPrice+315
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+315, sellCostMeanBuyPrice = sellCostMeanBuyPrice+315
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+315, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+315
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+315
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+315
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+315
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '420', userid = '1', storedetaildate = '2026-10-19 12:20:48' WHERE storedetailid = '6';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '3', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '423', '420', '1', '2026-10-19 12:20:48','0','0'); -- id=4813
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 162;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('105','00011', '340', '1', '11', '6', '109', '654', '0', '', '1', '2026-10-19 12:20:48', '11', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','162-6,','1','1','0','0','109','654','0','','0','0.00','0','0','0','0'); -- id=2713
UPDATE sellbilldetail SET  lastbuyprice = 105.00 , meanbuyprice = 105.00, lastbuyprice_withDiscount = 105.00, meanbuyprice_withDiscount = 105.00
        , lastbuyprice_withTax = 105, meanbuyprice_withTax = 105, lastbuyprice_withDiscountAndTax = 105
                where sellbilldetailid = 2713;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (11, '2026-10-19', 654, 630, 630
                    , 630, 630, 630, 630
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 630, 630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+654, sellCostBuyPrice =sellCostBuyPrice+630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+630, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+630
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+630
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+630
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 654, 630, 630
                    , 630, 630, 630, 630
                    , 0, 0, 0, 0
                    , 0, 0, 0, 630, 630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+654, sellCostBuyPrice =sellCostBuyPrice+630
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+630, sellCostMeanBuyPrice = sellCostMeanBuyPrice+630
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+630, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+630
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+630
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+630
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '256', userid = '1', storedetaildate = '2026-10-19 12:20:48' WHERE storedetailid = '11';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('11', '1', '6', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '262', '256', '1', '2026-10-19 12:20:48','0','0'); -- id=4814
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 216;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('84.46','00007', '340', '1', '7', '1', '87', '87', '0', '', '1', '2026-10-19 12:20:48', '7', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','216-1,','1','1','0','0','87','87','0','','0','0.00','0','0','0','0'); -- id=2714
UPDATE sellbilldetail SET  lastbuyprice = 84.46 , meanbuyprice = 84.46, lastbuyprice_withDiscount = 84.46, meanbuyprice_withDiscount = 84.46
        , lastbuyprice_withTax = 84.46, meanbuyprice_withTax = 84.46, lastbuyprice_withDiscountAndTax = 84.46
                where sellbilldetailid = 2714;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (7, '2026-10-19', 87, 84.46, 84.46
                    , 84.46, 84.46, 84.46, 84.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 84.46, 84.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+87, sellCostBuyPrice =sellCostBuyPrice+84.46
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.46, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.46, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.46
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.46
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 87, 84.46, 84.46
                    , 84.46, 84.46, 84.46, 84.46
                    , 0, 0, 0, 0
                    , 0, 0, 0, 84.46, 84.46, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+87, sellCostBuyPrice =sellCostBuyPrice+84.46
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+84.46, sellCostMeanBuyPrice = sellCostMeanBuyPrice+84.46
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+84.46, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+84.46
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+84.46
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+84.46
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+84.46
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '185', userid = '1', storedetaildate = '2026-10-19 12:20:48' WHERE storedetailid = '7';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('7', '1', '1', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '186', '185', '1', '2026-10-19 12:20:48','0','0'); -- id=4815
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 217;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('47','00014', '340', '1', '14', '1', '49.9', '49.9', '0', '', '1', '2026-10-19 12:20:48', '14', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','217-1,','1','1','0','0','49.9','49.9','0','','0','0.00','0','0','0','0'); -- id=2715
UPDATE sellbilldetail SET  lastbuyprice = 47.00 , meanbuyprice = 47.00, lastbuyprice_withDiscount = 47.00, meanbuyprice_withDiscount = 47.00
        , lastbuyprice_withTax = 47, meanbuyprice_withTax = 47, lastbuyprice_withDiscountAndTax = 47
                where sellbilldetailid = 2715;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (14, '2026-10-19', 49.9, 47, 47
                    , 47, 47, 47, 47
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 47, 47, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49.9, sellCostBuyPrice =sellCostBuyPrice+47
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+47, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+47
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+47
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+47
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 49.9, 47, 47
                    , 47, 47, 47, 47
                    , 0, 0, 0, 0
                    , 0, 0, 0, 47, 47, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+49.9, sellCostBuyPrice =sellCostBuyPrice+47
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+47, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+47
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+47
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+47
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '137', userid = '1', storedetaildate = '2026-10-19 12:20:49' WHERE storedetailid = '14';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('14', '1', '1', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '138', '137', '1', '2026-10-19 12:20:49','0','0'); -- id=4816
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('14.7','00564', '340', '21', '564', '65', '16', '1040', '0', '', '1', '2026-10-19 12:20:49', '564', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','16','1040','0','','0','0.00','0','0','0','0'); -- id=2716
UPDATE sellbilldetail SET  lastbuyprice = 14.70 , meanbuyprice = 14.70, lastbuyprice_withDiscount = 14.70, meanbuyprice_withDiscount = 14.70
        , lastbuyprice_withTax = 14.7, meanbuyprice_withTax = 14.7, lastbuyprice_withDiscountAndTax = 14.7
                where sellbilldetailid = 2716;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (564, '2026-10-19', 1040, 955.5, 955.5
                    , 955.5, 955.5, 955.5, 955.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 0, 955.5, 955.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1040, sellCostBuyPrice =sellCostBuyPrice+955.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+955.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+955.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+955.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+955.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+955.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+955.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+955.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-10-19', 1040, 955.5, 955.5
                    , 955.5, 955.5, 955.5, 955.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 955.5, 955.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1040, sellCostBuyPrice =sellCostBuyPrice+955.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+955.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+955.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+955.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+955.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+955.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+955.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+955.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 = '184', userid = '1', storedetaildate = '2026-10-19 12:20:49' WHERE storedetailid = '564';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('564', '1', '65', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '249', '184', '1', '2026-10-19 12:20:49','0','0'); -- id=4817
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+65 where id = 211;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('22','00604', '340', '20', '604', '65', '32', '2080', '0', '', '1', '2026-10-19 12:20:49', '604', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','211-65,','1','1','0','0','32','2080','0','','0','0.00','0','0','0','0'); -- id=2717
UPDATE sellbilldetail SET  lastbuyprice = 22.00 , meanbuyprice = 22.00, lastbuyprice_withDiscount = 22.00, meanbuyprice_withDiscount = 22.00
        , lastbuyprice_withTax = 22, meanbuyprice_withTax = 22, lastbuyprice_withDiscountAndTax = 22
                where sellbilldetailid = 2717;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (604, '2026-10-19', 2080, 1430, 1430
                    , 1430, 1430, 1430, 1430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65, 0, 1430, 1430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2080, sellCostBuyPrice =sellCostBuyPrice+1430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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-10-19', 2080, 1430, 1430
                    , 1430, 1430, 1430, 1430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1430, 1430, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2080, sellCostBuyPrice =sellCostBuyPrice+1430
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1430, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1430
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1430
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1430
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '285', userid = '1', storedetaildate = '2026-10-19 12:20:49' WHERE storedetailid = '604';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('604', '1', '65', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '350', '285', '1', '2026-10-19 12:20:49','0','0'); -- id=4818
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 192;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('108.5','00110', '340', '3', '110', '6', '110', '660', '0', '', '1', '2026-10-19 12:20:49', '110', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','192-6,','1','1','0','0','110','660','0','','0','0.00','0','0','0','0'); -- id=2718
UPDATE sellbilldetail SET  lastbuyprice = 108.50 , meanbuyprice = 108.00, lastbuyprice_withDiscount = 108.50, meanbuyprice_withDiscount = 108.00
        , lastbuyprice_withTax = 108.5, meanbuyprice_withTax = 108, lastbuyprice_withDiscountAndTax = 108.5
                where sellbilldetailid = 2718;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (110, '2026-10-19', 660, 651, 651
                    , 648, 651, 648, 651
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 651, 648, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+651
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+651, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+651, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+651
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+651
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 660, 651, 651
                    , 648, 651, 648, 651
                    , 0, 0, 0, 0
                    , 0, 0, 0, 651, 648, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+660, sellCostBuyPrice =sellCostBuyPrice+651
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+651, sellCostMeanBuyPrice = sellCostMeanBuyPrice+648
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+651, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+648
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+651
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+651
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+648
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-19 12:20:50' WHERE storedetailid = '110';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('110', '1', '6', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '1', '2026-10-19 12:20:50','0','0'); -- id=4819
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 176;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('101','00109', '340', '3', '109', '7', '103', '721', '0', '', '1', '2026-10-19 12:20:50', '109', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','176-7,','1','1','0','0','103','721','0','','0','0.00','0','0','0','0'); -- id=2719
UPDATE sellbilldetail SET  lastbuyprice = 101.00 , meanbuyprice = 101.00, lastbuyprice_withDiscount = 101.00, meanbuyprice_withDiscount = 101.00
        , lastbuyprice_withTax = 101, meanbuyprice_withTax = 101, lastbuyprice_withDiscountAndTax = 101
                where sellbilldetailid = 2719;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (109, '2026-10-19', 721, 707, 707
                    , 707, 707, 707, 707
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 707, 707, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+721, sellCostBuyPrice =sellCostBuyPrice+707
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+707, sellCostMeanBuyPrice = sellCostMeanBuyPrice+707
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+707, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+707
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+707
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+707
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+707
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 721, 707, 707
                    , 707, 707, 707, 707
                    , 0, 0, 0, 0
                    , 0, 0, 0, 707, 707, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+721, sellCostBuyPrice =sellCostBuyPrice+707
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+707, sellCostMeanBuyPrice = sellCostMeanBuyPrice+707
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+707, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+707
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+707
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+707
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+707
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-10-19 12:20:50' WHERE storedetailid = '109';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('109', '1', '7', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '41', '1', '2026-10-19 12:20:50','0','0'); -- id=4820
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+54 where id = 155;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('52.75','00001', '340', '1', '1', '54', '54.78', '2958.12', '0', '', '1', '2026-10-19 12:20:50', '1', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','155-54,','1','1','0','0','54.78','2958.12','0','','0','0.00','0','0','0','0'); -- id=2720
UPDATE sellbilldetail SET  lastbuyprice = 52.75 , meanbuyprice = 52.75, lastbuyprice_withDiscount = 52.75, meanbuyprice_withDiscount = 52.75
        , lastbuyprice_withTax = 52.75, meanbuyprice_withTax = 52.75, lastbuyprice_withDiscountAndTax = 52.75
                where sellbilldetailid = 2720;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2958.12, 2848.5, 2848.5
                    , 2848.5, 2848.5, 2848.5, 2848.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 54, 0, 2848.5, 2848.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2958.12, sellCostBuyPrice =sellCostBuyPrice+2848.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2848.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2848.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2848.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2848.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2848.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2848.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2848.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+54
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2958.12, 2848.5, 2848.5
                    , 2848.5, 2848.5, 2848.5, 2848.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2848.5, 2848.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2958.12, sellCostBuyPrice =sellCostBuyPrice+2848.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2848.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2848.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2848.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2848.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2848.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2848.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2848.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 = '2261', userid = '1', storedetaildate = '2026-10-19 12:20:51' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '54', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2315', '2261', '1', '2026-10-19 12:20:51','0','0'); -- id=4821
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+75 where id = 163;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10.55','00005', '340', '1', '5', '75', '10.95', '821.25', '0', '', '1', '2026-10-19 12:20:51', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','163-75,','1','1','0','0','10.95','821.25','0','','0','0.00','0','0','0','0'); -- id=2721
UPDATE sellbilldetail SET  lastbuyprice = 10.55 , meanbuyprice = 10.55, lastbuyprice_withDiscount = 10.55, meanbuyprice_withDiscount = 10.55
        , lastbuyprice_withTax = 10.55, meanbuyprice_withTax = 10.55, lastbuyprice_withDiscountAndTax = 10.55
                where sellbilldetailid = 2721;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2026-10-19', 821.25, 791.25, 791.25
                    , 791.25, 791.25, 791.25, 791.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 75, 0, 791.25, 791.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+821.25, sellCostBuyPrice =sellCostBuyPrice+791.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+791.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+791.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+791.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+791.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+791.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+791.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+791.25
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+75
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 821.25, 791.25, 791.25
                    , 791.25, 791.25, 791.25, 791.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 791.25, 791.25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+821.25, sellCostBuyPrice =sellCostBuyPrice+791.25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+791.25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+791.25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+791.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+791.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+791.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+791.25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+791.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 = '5439', userid = '1', storedetaildate = '2026-10-19 12:20:51' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '75', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5514', '5439', '1', '2026-10-19 12:20:51','0','0'); -- id=4822
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+30 where id = 153;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00003', '340', '1', '3', '30', '36', '1080', '0', '', '1', '2026-10-19 12:20:51', '3', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','153-30,','1','1','0','0','36','1080','0','','0','0.00','0','0','0','0'); -- id=2722
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 2722;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-10-19', 1080, 1044, 1044
                    , 1044, 1044, 1044, 1044
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 1044, 1044, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1044
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1044, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1044
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1044, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1044
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1044
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1044
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1044
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1080, 1044, 1044
                    , 1044, 1044, 1044, 1044
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1044, 1044, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1044
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1044, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1044
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1044, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1044
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1044
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1044
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1044
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2570', userid = '1', storedetaildate = '2026-10-19 12:20:51' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '30', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2600', '2570', '1', '2026-10-19 12:20:51','0','0'); -- id=4823
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+35 where id = 154;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00004', '340', '1', '4', '35', '36', '1260', '0', '', '1', '2026-10-19 12:20:51', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','154-35,','1','1','0','0','36','1260','0','','0','0.00','0','0','0','0'); -- id=2723
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 2723;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-10-19', 1260, 1218, 1218
                    , 1218, 1218, 1218, 1218
                    , 0, 0, 0, 0
                    , 0, 0, 0, 35, 0, 1218, 1218, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1218
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1218, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1218
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1218, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1218
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1218
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1218
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1218
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+35
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1260, 1218, 1218
                    , 1218, 1218, 1218, 1218
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1218, 1218, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1218
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1218, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1218
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1218, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1218
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1218
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1218
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1218
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2719', userid = '1', storedetaildate = '2026-10-19 12:20:52' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '35', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2754', '2719', '1', '2026-10-19 12:20:52','0','0'); -- id=4824
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 57;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('163','00015', '340', '1', '15', '2', '170', '340', '0', '', '1', '2026-10-19 12:20:52', '15', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','57-2,','1','1','0','0','170','340','0','','0','0.00','0','0','0','0'); -- id=2724
UPDATE sellbilldetail SET  lastbuyprice = 163.00 , meanbuyprice = 163.00, lastbuyprice_withDiscount = 163.00, meanbuyprice_withDiscount = 163.00
        , lastbuyprice_withTax = 163, meanbuyprice_withTax = 163, lastbuyprice_withDiscountAndTax = 163
                where sellbilldetailid = 2724;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (15, '2026-10-19', 340, 326, 326
                    , 326, 326, 326, 326
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 326, 326, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+326
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+326, sellCostMeanBuyPrice = sellCostMeanBuyPrice+326
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+326, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+326
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+326
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+326
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+326
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 340, 326, 326
                    , 326, 326, 326, 326
                    , 0, 0, 0, 0
                    , 0, 0, 0, 326, 326, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+326
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+326, sellCostMeanBuyPrice = sellCostMeanBuyPrice+326
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+326, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+326
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+326
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+326
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+326
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-10-19 12:20:52' WHERE storedetailid = '15';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('15', '1', '2', '1', '340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '279', '277', '1', '2026-10-19 12:20:52','0','0'); -- id=4825
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21216.97', '21216.97', '2026-10-19', '1', '0', '0', '2026-10-19 12:20:52','اضافة فاتورة مبيعات رقم 340','1','0',null,'0','340','sellbillController.php?do=showDetail&sellbillid=340'); -- id=1757
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1757', '504', '21216.97', '','0'); -- id=1773
UPDATE accountstree SET name = 'ايمن فريد', customName = 'ايمن فريد', customNameEn = 'ايمن فريد', nameEn = 'ايمن فريد', parent = '58', accountNature = '0', theValue = '21216.97', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-19 12:09:22' WHERE id = '504';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1757', '143', '21216.97', '','0'); -- id=1761
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1516222.3', 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 ( '18328.71', '18328.71', '2026-10-19', '1', '0', '0', '2026-10-19 12:20:52','اضافة فاتورة مبيعات رقم 340 - صرف البضاعة من المخزن','1','0',null,'0','340','sellbillController.php?do=showDetail&sellbillid=340'); -- id=1758
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1758', '402', '18328.71', '','0'); -- id=1774
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1353510.04', 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 ('1758', '382', '18328.71', '','0'); -- id=1762
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2192684.06', 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='1757,0,1758' where sellbillid=340;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 21216.97, 18328.71, 18328.71
                    , 18315.04, 18328.71, 18315.04, 18328.71
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18328.71, 18315.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21216.97, sellCostBuyPrice =sellCostBuyPrice+18328.71
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18328.71, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18315.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18328.71, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18315.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18328.71
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18328.71
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18315.04
                        , returnSellVal = returnSellVal+0, 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 (71, '2026-10-19', 21216.97, 18328.71, 18328.71
                    , 18315.04, 18328.71, 18315.04, 18328.71
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18328.71, 18315.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21216.97, sellCostBuyPrice =sellCostBuyPrice+18328.71
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18328.71, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18315.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18328.71, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18315.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18328.71
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18328.71
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18315.04
                        , returnSellVal = returnSellVal+0, 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, 21216.97, 18328.71, 18328.71
                    , 18315.04, 18328.71, 18315.04, 18328.71, 18328.71, 18315.04)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+21216.97, netSellCostBuyPrice = netSellCostBuyPrice+18328.71
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18328.71
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18315.04
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+18328.71
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18315.04
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+18328.71
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18328.71
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18315.04;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad5ec099f593 and sellbillId = 340 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 08:50:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 12:20:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 12:20:54', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4567
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 09:40:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:10:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 13:10:16', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4568
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 09:49:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:19:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 13:19:12', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4569

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =577
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(71,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '0' , clientdate = '2026-10-19 13:19:12', userid = '1' WHERE clientid = '71';
UPDATE client SET  inUse = 0 where clientid = 71;
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 ('71','21216.97','21216.97','1','ايصال تحصيل (( قبض من عميل ))','577', '0', '2026-10-19 13:10:17', '1', 'clientPayedDeptController.php', '   ', '21216.97', '0', null, '0', null, null,'', '-1','1','1','21216.97','1','','61','0','','.'); -- id=577
UPDATE save SET  savecurrentvalue = '-812165.09',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-833382.06','21216.97', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '577', '-812165.09', '2026-10-19 13:19:13', '1',  'clientPayedDeptController.php','71','','0'); -- id=357
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21216.97', '21216.97', '2026-10-19', '1', '0', '0', '2026-10-19 13:19:13','اضافة ايصال سداد للعميل ايمن فريد','1','0','0','0','577','clientPayedDeptController.php?do=show&id=577'); -- id=1759
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1759', '383', '21216.97', '','0'); -- id=1775
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '171299.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 dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1759', '504', '21216.97', '','0'); -- id=1763
UPDATE accountstree SET name = 'ايمن فريد', customName = 'ايمن فريد', customNameEn = 'ايمن فريد', nameEn = 'ايمن فريد', parent = '58', accountNature = '0', theValue = '0', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-19 12:09:22' WHERE id = '504';
UPDATE clientdebtchange SET clientid = '71', clientdebtchangebefore = '21216.970', clientdebtchangeamount = '21216.970', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '577', clientdebtchangeafter = '0.000', clientdebtchangedate = '2026-10-19 13:10:17', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '21216.970',discount='', reciptid='0', dailyentryid = '1759',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='21216.97',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '577';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 09:49:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:19:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 13:19:14', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4570
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 09:49:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:19:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 13:19:15', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4571
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:13:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:43:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:43:12', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4572
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:13:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:43:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:43:42', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4573

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad60250dc8ac
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(9,@clientdebt,@clientname,@treeIdis);
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-19 13:43:42', '06ad60250dc8ac', '9', '5728.75', '4798.75', '0', '1', '930', '930', '0', '-930', '1', '2026-10-19 13:43:43', '', '1', '0', 'طارق عز','1', '1', '5', '0', '9 - طارق عز', '10', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','1','1','','0'); -- id=23
UPDATE client SET  clientdebt = '4798.75', userid = '1' WHERE clientid = '9';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('9','5728.75','930','1','اضافة فاتورة مردوات مبيعات','23', '4798.75', '2026-10-19 13:43:43', '1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '930', '0', null, '0', null, null,'', '0','1','1','930','1','2026-10-19 13:43:42','0','0','',''); -- id=578
UPDATE client SET  inUse = 0 where clientid = 9;
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 ('80.00', '00387', '23', '7', '387', '10', '93', '930', '0', '', '1', '0', '387', '0.00', '-1','1','0','','','0','0','0','0','0','1','1','1','','0','0','93','930','0','','0'); -- id=121
UPDATE returnsellbilldetail SET  lastbuyprice = 80.00 , meanbuyprice = 79.95, lastbuyprice_withDiscount = 80.00, meanbuyprice_withDiscount = 79.95
        , lastbuyprice_withTax = 80, meanbuyprice_withTax = 79.95, lastbuyprice_withDiscountAndTax = 80
                where returnsellbilldetailid = 121;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (387, '2026-10-19', 0, 0, 0
                    , 0, 0, 0, 0
                    , 930, 800, 800, 799.5
                    , 800, 799.5, 800, 0, 10, 0, 0, 800, 799.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+930, returnSellCostBuyPrice = returnSellCostBuyPrice+800, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+800
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+799.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+800
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+799.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+800
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+800
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+799.5
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+10;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 0, 0, 0
                    , 0, 0, 0, 0
                    , 930, 800, 800, 799.5
                    , 800, 799.5, 800, 0, 0, 800, 799.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+930, returnSellCostBuyPrice = returnSellCostBuyPrice+800, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+800
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+799.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+800
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+799.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+800
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+800
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+799.5;
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2026-10-19 13:43:43' WHERE storedetailid = '387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('387', '1', '10', '0', '23', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '16', '26', '1', '2026-10-19 13:43:43','0','0'); -- id=4826
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '930', '930', '2026-10-19', '1', '0', '0', '2026-10-19 13:43:43','اضافة فاتورة مردود مبيعات رقم 23','1','0',null,'0','23','returnsellbillController.php?do=showDetail&returnsellbillid=23'); -- id=1760
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1760', '143', '930', '','0'); -- id=1776
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1515292.3', 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 ('1760', '436', '930', '','0'); -- id=1764
UPDATE accountstree SET name = 'طارق عز', customName = 'طارق عز', customNameEn = 'طارق عز', nameEn = 'طارق عز', parent = '58', accountNature = '0', theValue = '4798.75', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-16 13:28:38' WHERE id = '436';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '800', '800', '2026-10-19', '1', '0', '0', '2026-10-19 13:43:43','اضافة فاتورة مردود مبيعات رقم 23 - صرف البضاعة من المخزن','1','0',null,'0','23','returnsellbillController.php?do=showDetail&returnsellbillid=23'); -- id=1761
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1761', '382', '800', '','0'); -- id=1777
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2193484.06', 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 ('1761', '402', '800', '','0'); -- id=1765
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1352710.04', 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='1760,0,1761' where returnsellbillid=23;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 0, 0, 0
                    , 0, 0, 0, 0
                    , 930, 800, 800, 799.5
                    , 800, 799.5, 800 ,0, 0, 800, 799.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+930, returnSellCostBuyPrice = returnSellCostBuyPrice+800, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+800
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+799.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+800
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+799.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+800
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+800
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+799.5;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (9, '2026-10-19', 0, 0, 0
                    , 0, 0, 0, 0
                    , 930, 800, 800, 799.5
                    , 800, 799.5, 800 ,0, 0, 800, 799.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+930, returnSellCostBuyPrice = returnSellCostBuyPrice+800, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+800
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+799.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+800
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+799.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+800
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+800
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+799.5;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -930, -800, -800
                    , -799.5, -800, -799.5, -800, -800, -799.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-930, netSellCostBuyPrice = netSellCostBuyPrice+-800
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-800
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-799.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-800
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-799.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-800
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-800
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-799.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad60250dc8ac and sellbillId = 23 and returnsellbillId = 23
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:13:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:43:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:43:46', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=4574
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:15:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:45:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:45:35', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4575
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:15:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:45:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-19 13:45:44', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php'); -- id=4576
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:15:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:45:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-19 13:45:45', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4577
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:15:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:45:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-19 13:45:49', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4578
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:15:56";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:45:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-19 13:45:56', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4579
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:16:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:46:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2026-10-19 13:46:00', '1', 'showallajax', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientdebt.php?do=showallajax'); -- id=4580
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:16:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:46:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:46:17', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4581
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:16:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:46:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:46:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4582
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:16:31";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:46:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:46:31', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=335'); -- id=4583
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:16:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:46:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:46:46', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4584
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 335;
UPDATE sellbill SET  sellbillsysdate = '2026-10-19 13:46:46', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '335';
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2678;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '68', userid = '1', storedetaildate = '2026-10-19 13:46:46' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '0', '335', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '68', '1', '2026-10-19 09:53:42','0','0'); -- id=4827
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '1986', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','2176.00','190.00','1','تعديل فاتورة مبيعات','335', '1986', '2026-10-19 09:53:42', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '190', '0', null, '0', null, null,'', '0','1','1','190','1','2026-10-19 09:53:42','0','0','',''); -- id=579
UPDATE client SET  inUse = 0 where clientid = 46;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 190, 180, 180
                    , 180, 180, 180, 180, 180, 180)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-190, netSellCostBuyPrice = netSellCostBuyPrice-180
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-180
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-180
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-180
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-180
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-180
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-180
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-180;

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


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

COMMIT;
BEGIN;
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 09:53:42', '06ad5cc6d650ca', '46', '1986.00', '2296', '0', '1', '310', '310', '0', '310', '1', '2026-10-19 09:53:42', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '18', '335', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=341
UPDATE client SET  clientdebt = '2296', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','1986.00','310','0','اضافة فاتورة مبيعات (معدله)','341', '2296', '2026-10-19 13:46:47', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '310', '0', null, '0', null, null,'', '0','1','1','190','1','2026-10-19 09:53:42','0','0','',''); -- id=580
UPDATE client SET  inUse = 0 where clientid = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '341', '14', '81', '10.00', '19', '190', '0', '', '1', '2026-10-19 13:46:48', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=2725
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2725;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 13:46:48' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '341', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '68', '58', '1', '2026-10-19 13:46:48','0','0'); -- id=4828
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '341', '6', '207', '8', '15', '120', '0', '', '1', '2026-10-19 13:46:48', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','120','0','','0','0.00','0','0','0','0'); -- id=2726
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2726;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-19 13:46:48' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '341', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '50', '1', '2026-10-19 13:46:48','0','0'); -- id=4829
UPDATE dailyentry SET totalcreditor = '190.00', totaldebtor = '190.00', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 09:53:44', entryComment = 'اضافة فاتورة مبيعات رقم 335', fromFlag = '1',related='0',isopeningentry='0',operationId='335',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=335' WHERE id = '1741';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '190.00', '190.00', '2026-10-19', '1', '0', '1741', '2026-10-19 13:46:48','تم عكس القيد رقم 1741 ','1','0','0','0','0',''); -- id=1762
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1762', '479', '190.00', '','0'); -- id=1766
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '1986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1762', '143', '190.00', '','0'); -- id=1778
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1515102.3', 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 = '180.00', totaldebtor = '180.00', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 09:53:44', entryComment = 'اضافة فاتورة مبيعات رقم 335 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='335',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=335' WHERE id = '1742';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '180.00', '180.00', '2026-10-19', '1', '0', '1742', '2026-10-19 13:46:49','تم عكس القيد رقم 1742 ','1','0','0','0','0',''); -- id=1763
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1763', '402', '180.00', '','0'); -- id=1767
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1352530.04', 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 ('1763', '382', '180.00', '','0'); -- id=1779
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2193664.06', 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 ( '310', '310', '2026-10-19', '1', '0', '0', '2026-10-19 13:46:49','اضافة فاتورة مبيعات رقم 341','1','0',null,'0','341','sellbillController.php?do=showDetail&sellbillid=341'); -- id=1764
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1764', '479', '310', '','0'); -- id=1780
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '2296', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1764', '143', '310', '','0'); -- id=1768
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1515412.3', 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 ( '268', '268', '2026-10-19', '1', '0', '0', '2026-10-19 13:46:49','اضافة فاتورة مبيعات رقم 341 - صرف البضاعة من المخزن','1','0',null,'0','341','sellbillController.php?do=showDetail&sellbillid=341'); -- id=1765
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1765', '402', '268', '','0'); -- id=1781
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1352798.04', 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 ('1765', '382', '268', '','0'); -- id=1769
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2193396.06', 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='1764,0,1765' where sellbillid=341;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 310, 268, 268
                    , 268, 268, 268, 268
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,268, 268, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+310, sellCostBuyPrice =sellCostBuyPrice+268
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+268, sellCostMeanBuyPrice = sellCostMeanBuyPrice+268
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+268
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+268
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-19', 310, 268, 268
                    , 268, 268, 268, 268
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,268, 268, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+310, sellCostBuyPrice =sellCostBuyPrice+268
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+268, sellCostMeanBuyPrice = sellCostMeanBuyPrice+268
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+268
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+268
                        , returnSellVal = returnSellVal+0, 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, 310, 268, 268
                    , 268, 268, 268, 268, 268, 268)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+310, netSellCostBuyPrice = netSellCostBuyPrice+268
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+268
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+268
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+268
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+268
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+268
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+268
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+268;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 335 and newid=341 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:16:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 13:46:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 13:46:51', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=341'); -- id=4585
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:39:26";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:09:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:09:26', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4586
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:39:33";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:09:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:09:33', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4587
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:39:43";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:09:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:09:43', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=341'); -- id=4588
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:43:37";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:13:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 14:13:37', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4589
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:45:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:15:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 14:15:04', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4590
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('شاسيه اسبوط مدور ابيض ','','20','13.5','15','16','15','2026-10-19','0','1','0','','0','0','0','0','0','13.5','13.5','13.5','13.5','13.5','0','11.11','11.11','18.52','.','0','0','0','13.5','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','13.5','13.5','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','13.5','0','0','0','0','0','0','','','0','0','0','0'); -- id=606
UPDATE product SET productName = 'شاسيه اسبوط مدور ابيض ', productDescription = '', productCatId = '20', productBuyPrice = '13.5', productSellAllPrice = '15', productSellUnitPrice = '16', productSellHalfPrice = '15', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00606',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '13.5',lastbuyprice_withDiscount = '13.5',meanbuyprice = '13.5',meanbuyprice_withDiscount = '13.5' , productbuypricereal = '13.5' , buypricereal_precentage = '0' , buytotal_precentage = '11.11' , buyhalf_precentage = '11.11' , buypart_precentage = '18.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='13.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='13.5',meanbuyprice_withTax='13.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='13.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 = '606';
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', '606', '1.00', '2026-10-19', '1', '0','0060601','15','15','16','13.5','','0','0','0','0','0','0','0','0','0','0'); -- id=606
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('606', '1', '27', '1', '2026-10-19'); -- id=606
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('606', '1', '27', '0', '606', 'إضافة منتج', 'productController.php', '0', '27', '1', '2026-10-19','0','0'); -- id=4830
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (606, 1,'2026-10-19 14:15:06',1)
                ON DUPLICATE KEY UPDATE productid = 606, edited = 1, sysdate = '2026-10-19 14:15:06', userid = 1; -- id=808
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '364.5', '364.5', '2026-10-19', '1', '0', '0', '2026-10-19 14:15:06','إضافة منتج شاسيه اسبوط مدور ابيض  الكمية 27','1','0','0','0','606','productController.php?do=edit&id=606'); -- id=1766
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1766', '382', '364.5', '','0'); -- id=1782
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2193760.56', 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 ('1766', '121', '364.5', '','0'); -- id=1770
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1850239.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'شاسيه اسبوط مدور ابيض ', productDescription = '', productCatId = '20', productBuyPrice = '13.50', productSellAllPrice = '15.00', productSellUnitPrice = '16.00', productSellHalfPrice = '15.00', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00606',type ='0', expireDate = '0' , dailyentryId = '1766',isService = '0',isOptic = '0',lastbuyprice = '13.5',lastbuyprice_withDiscount = '13.5',meanbuyprice = '13.5',meanbuyprice_withDiscount = '13.5' , productbuypricereal = '13.5' , buypricereal_precentage = '0' , buytotal_precentage = '11.11' , buyhalf_precentage = '11.11' , buypart_precentage = '18.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='13.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='13.5',meanbuyprice_withTax='13.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='13.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 = '606';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:45:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:15:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 14:15:08', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4591
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:45:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:15:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:15:54', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4592
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:48:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:18:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:18:16', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4593
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 341;
UPDATE sellbill SET  sellbillsysdate = '2026-10-19 14:18:17', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '341';
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2725;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '68', userid = '1', storedetaildate = '2026-10-19 14:18:17' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '0', '341', 'تعديل فاتورة مبيعات', 'sellbillController.php', '58', '68', '1', '2026-10-19 09:53:42','0','0'); -- id=4831
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2726;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 14:18:17' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '0', '341', 'تعديل فاتورة مبيعات', 'sellbillController.php', '50', '58', '1', '2026-10-19 09:53:42','0','0'); -- id=4832
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '1986', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','2296.00','310.00','1','تعديل فاتورة مبيعات','341', '1986', '2026-10-19 09:53:42', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '310', '0', null, '0', null, null,'', '0','1','1','310','1','2026-10-19 09:53:42','0','0','',''); -- id=581
UPDATE client SET  inUse = 0 where clientid = 46;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 310, 268, 268
                    , 268, 268, 268, 268
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,268, 268, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-310, sellCostBuyPrice =sellCostBuyPrice-268
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-268, sellCostMeanBuyPrice = sellCostMeanBuyPrice-268
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-268
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-268
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-19', 310, 268, 268
                    , 268, 268, 268, 268
                    , 0, 0, 0, 0
                    , 0, 0, 0, 268, 268, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-310, sellCostBuyPrice =sellCostBuyPrice-268
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-268, sellCostMeanBuyPrice = sellCostMeanBuyPrice-268
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-268
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-268
                        , returnSellVal = returnSellVal-0, 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, 310, 268, 268
                    , 268, 268, 268, 268, 268, 268)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-310, netSellCostBuyPrice = netSellCostBuyPrice-268
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-268
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-268
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-268
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-268
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-268
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-268
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-268;

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


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

COMMIT;
BEGIN;
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 09:53:42', '06ad5cc6d650ca', '46', '1986.00', '3311.5', '0', '1', '1325.5', '1325.5', '0', '1325.5', '1', '2026-10-19 09:53:42', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '76', '341', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=342
UPDATE client SET  clientdebt = '3311.5', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','1986.00','1325.5','0','اضافة فاتورة مبيعات (معدله)','342', '3311.5', '2026-10-19 14:18:18', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '1325.5', '0', null, '0', null, null,'', '0','1','1','310','1','2026-10-19 09:53:42','0','0','',''); -- id=582
UPDATE client SET  inUse = 0 where clientid = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '342', '14', '81', '10.00', '19', '190', '0', '', '1', '2026-10-19 14:18:18', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=2727
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2727;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 14:18:18' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '342', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '68', '58', '1', '2026-10-19 14:18:18','0','0'); -- id=4833
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '342', '6', '207', '8.00', '15', '120', '0', '', '1', '2026-10-19 14:18:18', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','120','0','','0','0.00','0','0','0','0'); -- id=2728
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2728;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-19 14:18:19' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '342', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '50', '1', '2026-10-19 14:18:19','0','0'); -- id=4834
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '342', '3', '100', '25', '17.75', '443.75', '0', '', '1', '2026-10-19 14:18:19', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','200-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2729
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 = 2729;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '369', userid = '1', storedetaildate = '2026-10-19 14:18:19' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '1', '342', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '394', '369', '1', '2026-10-19 14:18:19','0','0'); -- id=4835
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '342', '3', '101', '25', '17.75', '443.75', '0', '', '1', '2026-10-19 14:18:19', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2730
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 = 2730;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '246', userid = '1', storedetaildate = '2026-10-19 14:18:19' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '1', '342', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '271', '246', '1', '2026-10-19 14:18:19','0','0'); -- id=4836
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13.5','00606', '342', '20', '606', '8', '16', '128', '0', '', '1', '2026-10-19 14:18:19', '606', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','16','128','0','','0','0.00','0','0','0','0'); -- id=2731
UPDATE sellbilldetail SET  lastbuyprice = 13.50 , meanbuyprice = 13.50, lastbuyprice_withDiscount = 13.50, meanbuyprice_withDiscount = 13.50
        , lastbuyprice_withTax = 13.5, meanbuyprice_withTax = 13.5, lastbuyprice_withDiscountAndTax = 13.5
                where sellbilldetailid = 2731;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (606, '2026-10-19', 128, 108, 108
                    , 108, 108, 108, 108
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 108, 108, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+108
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+108, sellCostMeanBuyPrice = sellCostMeanBuyPrice+108
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+108, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+108
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+108
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+108
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+108
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 128, 108, 108
                    , 108, 108, 108, 108
                    , 0, 0, 0, 0
                    , 0, 0, 0, 108, 108, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+128, sellCostBuyPrice =sellCostBuyPrice+108
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+108, sellCostMeanBuyPrice = sellCostMeanBuyPrice+108
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+108, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+108
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+108
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+108
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+108
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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-10-19 14:18:20' WHERE storedetailid = '606';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('606', '1', '8', '1', '342', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '27', '19', '1', '2026-10-19 14:18:20','0','0'); -- id=4837
UPDATE dailyentry SET totalcreditor = '310.00', totaldebtor = '310.00', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 13:46:49', entryComment = 'اضافة فاتورة مبيعات رقم 341', fromFlag = '1',related='0',isopeningentry='0',operationId='341',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=341' WHERE id = '1764';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '310.00', '310.00', '2026-10-19', '1', '0', '1764', '2026-10-19 14:18:20','تم عكس القيد رقم 1764 ','1','0','0','0','0',''); -- id=1767
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1767', '479', '310.00', '','0'); -- id=1771
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '1986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1767', '143', '310.00', '','0'); -- id=1783
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1515102.3', 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 = '268.00', totaldebtor = '268.00', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 13:46:49', entryComment = 'اضافة فاتورة مبيعات رقم 341 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='341',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=341' WHERE id = '1765';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '268.00', '268.00', '2026-10-19', '1', '0', '1765', '2026-10-19 14:18:20','تم عكس القيد رقم 1765 ','1','0','0','0','0',''); -- id=1768
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1768', '402', '268.00', '','0'); -- id=1772
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1352530.04', 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 ('1768', '382', '268.00', '','0'); -- id=1784
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2194028.56', 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 ( '1325.5', '1325.5', '2026-10-19', '1', '0', '0', '2026-10-19 14:18:21','اضافة فاتورة مبيعات رقم 342','1','0',null,'0','342','sellbillController.php?do=showDetail&sellbillid=342'); -- id=1769
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1769', '479', '1325.5', '','0'); -- id=1785
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '3311.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1769', '143', '1325.5', '','0'); -- id=1773
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1516427.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';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1256', '1256', '2026-10-19', '1', '0', '0', '2026-10-19 14:18:21','اضافة فاتورة مبيعات رقم 342 - صرف البضاعة من المخزن','1','0',null,'0','342','sellbillController.php?do=showDetail&sellbillid=342'); -- id=1770
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1770', '402', '1256', '','0'); -- id=1786
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1353786.04', 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 ('1770', '382', '1256', '','0'); -- id=1774
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2192772.56', 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='1769,0,1770' where sellbillid=342;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 1325.5, 1256, 1256
                    , 1256, 1256, 1256, 1256
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1256, 1256, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325.5, sellCostBuyPrice =sellCostBuyPrice+1256
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1256, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1256
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1256, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1256
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1256
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1256
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1256
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-19', 1325.5, 1256, 1256
                    , 1256, 1256, 1256, 1256
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1256, 1256, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325.5, sellCostBuyPrice =sellCostBuyPrice+1256
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1256, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1256
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1256, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1256
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1256
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1256
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1256
                        , returnSellVal = returnSellVal+0, 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, 1325.5, 1256, 1256
                    , 1256, 1256, 1256, 1256, 1256, 1256)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1325.5, netSellCostBuyPrice = netSellCostBuyPrice+1256
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1256
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1256
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1256
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1256
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1256
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1256
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1256;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 341 and newid=342 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:48:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:18:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:18:22', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=342'); -- id=4594
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:53:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:23:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:23:36', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4595

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad609fb0d54d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 14:23:36', '06ad609fb0d54d', '1', '0.00', '0', '0', '1', '5712.55', '5712.55', '5712.55', '0', '1', '2026-10-19 14:23:36', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '72' ,'0','','','','','-1','0','0','0','0','0','5712','0','','0','0','5712.55','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=343
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','اضافة فاتورة مبيعات','343', '0', '2026-10-19 14:23:37', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5712.55', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 14:23:36','0','0','',''); -- id=583
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '343', '12', '86', '12', '6.25', '75', '0', '', '1', '2026-10-19 14:23:37', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.25','75','0','','0','0.00','0','0','0','0'); -- id=2732
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2732;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 75, 70.8, 70.8
                    , 70.8, 70.8, 70.8, 70.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 70.8, 70.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+70.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70.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+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 75, 70.8, 70.8
                    , 70.8, 70.8, 70.8, 70.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70.8, 70.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+70.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70.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 = '441', userid = '1', storedetaildate = '2026-10-19 14:23:37' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '12', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '453', '441', '1', '2026-10-19 14:23:37','0','0'); -- id=4838
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '343', '12', '87', '2', '11.3', '22.6', '0', '', '1', '2026-10-19 14:23:38', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','22.6','0','','0','0.00','0','0','0','0'); -- id=2733
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 = 2733;
 INSERT INTO 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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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 = '146', userid = '1', storedetaildate = '2026-10-19 14:23:38' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '2', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '148', '146', '1', '2026-10-19 14:23:38','0','0'); -- id=4839
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '343', '12', '88', '2', '11.3', '22.6', '0', '', '1', '2026-10-19 14:23:38', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','22.6','0','','0','0.00','0','0','0','0'); -- id=2734
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 = 2734;
 INSERT INTO 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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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 = '94', userid = '1', storedetaildate = '2026-10-19 14:23:38' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '2', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '96', '94', '1', '2026-10-19 14:23:38','0','0'); -- id=4840
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '343', '12', '82', '3', '34', '102', '0', '', '1', '2026-10-19 14:23:38', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-3,','1','1','0','0','34','102','0','','0','0.00','0','0','0','0'); -- id=2735
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2735;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-10-19 14:23:39' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '280', '277', '1', '2026-10-19 14:23:39','0','0'); -- id=4841
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '343', '12', '83', '1', '45', '45', '0', '', '1', '2026-10-19 14:23:39', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-1,','1','1','0','0','45','45','0','','0','0.00','0','0','0','0'); -- id=2736
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2736;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '230', userid = '1', storedetaildate = '2026-10-19 14:23:39' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '231', '230', '1', '2026-10-19 14:23:39','0','0'); -- id=4842
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 100;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('160','00084', '343', '12', '84', '1', '195', '195', '0', '', '1', '2026-10-19 14:23:39', '84', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','100-1,','1','1','0','0','195','195','0','','0','0.00','0','0','0','0'); -- id=2737
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 160.00
        , lastbuyprice_withTax = 160, meanbuyprice_withTax = 160, lastbuyprice_withDiscountAndTax = 160
                where sellbilldetailid = 2737;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (84, '2026-10-19', 195, 160, 160
                    , 160, 160, 160, 160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 160, 160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, sellCostBuyPrice =sellCostBuyPrice+160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 195, 160, 160
                    , 160, 160, 160, 160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 160, 160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, sellCostBuyPrice =sellCostBuyPrice+160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-19 14:23:39' WHERE storedetailid = '84';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('84', '1', '1', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '50', '1', '2026-10-19 14:23:39','0','0'); -- id=4843
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1040','00259', '343', '10', '259', '1', '1295', '1295', '0', '', '1', '2026-10-19 14:23:39', '259', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1295','1295','0','','0','0.00','0','0','0','0'); -- id=2738
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1040.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1040.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1040, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 2738;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (259, '2026-10-19', 1295, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1295, sellCostBuyPrice =sellCostBuyPrice+1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1295, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1295, sellCostBuyPrice =sellCostBuyPrice+1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-19 14:23:40' WHERE storedetailid = '259';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('259', '1', '1', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '2', '1', '2026-10-19 14:23:40','0','0'); -- id=4844
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2175','00251', '343', '10', '251', '1', '2395', '2395', '0', '', '1', '2026-10-19 14:23:40', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2395','2395','0','','0','0.00','0','0','0','0'); -- id=2739
UPDATE sellbilldetail SET  lastbuyprice = 2000.00 , meanbuyprice = 2087.50, lastbuyprice_withDiscount = 2000.00, meanbuyprice_withDiscount = 2087.50
        , lastbuyprice_withTax = 2087.5, meanbuyprice_withTax = 2087.5, lastbuyprice_withDiscountAndTax = 2000
                where sellbilldetailid = 2739;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-19', 2395, 2175, 2000
                    , 2087.5, 2000, 2087.5, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2087.5, 2087.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2395, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2087.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2087.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2087.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2087.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2395, 2175, 2000
                    , 2087.5, 2000, 2087.5, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2087.5, 2087.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2395, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2087.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2087.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2087.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2087.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 = '34', userid = '1', storedetaildate = '2026-10-19 14:23:40' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '34', '1', '2026-10-19 14:23:40','0','0'); -- id=4845
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('144','00157', '343', '22', '157', '6', '160', '960', '0', '', '1', '2026-10-19 14:23:40', '157', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','160','960','0','','0','0.00','0','0','0','0'); -- id=2740
UPDATE sellbilldetail SET  lastbuyprice = 144.00 , meanbuyprice = 144.00, lastbuyprice_withDiscount = 144.00, meanbuyprice_withDiscount = 144.00
        , lastbuyprice_withTax = 144, meanbuyprice_withTax = 144, lastbuyprice_withDiscountAndTax = 144
                where sellbilldetailid = 2740;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (157, '2026-10-19', 960, 864, 864
                    , 864, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 864, 864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+864, sellCostMeanBuyPrice = sellCostMeanBuyPrice+864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+864
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 960, 864, 864
                    , 864, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 864, 864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+864, sellCostMeanBuyPrice = sellCostMeanBuyPrice+864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+864
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-10-19 14:23:40' WHERE storedetailid = '157';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('157', '1', '6', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '47', '41', '1', '2026-10-19 14:23:40','0','0'); -- id=4846
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+13 where id = 203;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '343', '4', '279', '13', '14.6', '189.79999999999998', '0', '', '1', '2026-10-19 14:23:40', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','203-13,','1','1','0','0','14.6','189.8','0','','0','0.00','0','0','0','0'); -- id=2741
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 = 2741;
 INSERT INTO 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-10-19', 189.8, 182, 182
                    , 182, 182, 182, 182
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 0, 182, 182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.8, sellCostBuyPrice =sellCostBuyPrice+182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+182, sellCostMeanBuyPrice = sellCostMeanBuyPrice+182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+182
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+13
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 189.8, 182, 182
                    , 182, 182, 182, 182
                    , 0, 0, 0, 0
                    , 0, 0, 0, 182, 182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.8, sellCostBuyPrice =sellCostBuyPrice+182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+182, sellCostMeanBuyPrice = sellCostMeanBuyPrice+182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+182
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '168', userid = '1', storedetaildate = '2026-10-19 14:23:41' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '13', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '181', '168', '1', '2026-10-19 14:23:41','0','0'); -- id=4847
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('25','00312', '343', '4', '312', '1', '26', '26', '0', '', '1', '2026-10-19 14:23:41', '312', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','26','0','','0','0.00','0','0','0','0'); -- id=2742
UPDATE sellbilldetail SET  lastbuyprice = 25.00 , meanbuyprice = 25.00, lastbuyprice_withDiscount = 25.00, meanbuyprice_withDiscount = 25.00
        , lastbuyprice_withTax = 25, meanbuyprice_withTax = 25, lastbuyprice_withDiscountAndTax = 25
                where sellbilldetailid = 2742;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (312, '2026-10-19', 26, 25, 25
                    , 25, 25, 25, 25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 25, 25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26, sellCostBuyPrice =sellCostBuyPrice+25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 26, 25, 25
                    , 25, 25, 25, 25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26, sellCostBuyPrice =sellCostBuyPrice+25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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 = '23', userid = '1', storedetaildate = '2026-10-19 14:23:41' WHERE storedetailid = '312';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('312', '1', '1', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '23', '1', '2026-10-19 14:23:41','0','0'); -- id=4848
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+22 where id = 204;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00368', '343', '4', '368', '22', '7.5', '165', '0', '', '1', '2026-10-19 14:23:41', '368', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','204-22,','1','1','0','0','7.5','165','0','','0','0.00','0','0','0','0'); -- id=2743
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.00, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.00
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 2743;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (368, '2026-10-19', 165, 154, 154
                    , 154, 154, 154, 154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22, 0, 154, 154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+22
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 165, 154, 154
                    , 154, 154, 154, 154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 154, 154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '317', userid = '1', storedetaildate = '2026-10-19 14:23:41' WHERE storedetailid = '368';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('368', '1', '22', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '339', '317', '1', '2026-10-19 14:23:41','0','0'); -- id=4849
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.41','00313', '343', '4', '313', '1', '2.55', '2.55', '0', '', '1', '2026-10-19 14:23:41', '313', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','205-1,','1','1','0','0','2.55','2.55','0','','0','0.00','0','0','0','0'); -- id=2744
UPDATE sellbilldetail SET  lastbuyprice = 2.41 , meanbuyprice = 2.41, lastbuyprice_withDiscount = 2.41, meanbuyprice_withDiscount = 2.41
        , lastbuyprice_withTax = 2.41, meanbuyprice_withTax = 2.41, lastbuyprice_withDiscountAndTax = 2.41
                where sellbilldetailid = 2744;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (313, '2026-10-19', 2.55, 2.41, 2.41
                    , 2.41, 2.41, 2.41, 2.41
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2.41, 2.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2.55, sellCostBuyPrice =sellCostBuyPrice+2.41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2.41, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2.41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2.41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2.41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2.55, 2.41, 2.41
                    , 2.41, 2.41, 2.41, 2.41
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2.41, 2.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2.55, sellCostBuyPrice =sellCostBuyPrice+2.41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2.41, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2.41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2.41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2.41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '749', userid = '1', storedetaildate = '2026-10-19 14:23:42' WHERE storedetailid = '313';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('313', '1', '1', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '750', '749', '1', '2026-10-19 14:23:42','0','0'); -- id=4850
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 164;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('45','00567', '343', '9', '567', '3', '52', '156', '0', '', '1', '2026-10-19 14:23:42', '567', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','164-3,','1','1','0','0','52','156','0','','0','0.00','0','0','0','0'); -- id=2745
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 2745;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (567, '2026-10-19', 156, 135, 135
                    , 135, 135, 135, 135
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 135, 135, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+135
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+135, sellCostMeanBuyPrice = sellCostMeanBuyPrice+135
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+135, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+135
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+135
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+135
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+135
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 156, 135, 135
                    , 135, 135, 135, 135
                    , 0, 0, 0, 0
                    , 0, 0, 0, 135, 135, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+135
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+135, sellCostMeanBuyPrice = sellCostMeanBuyPrice+135
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+135, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+135
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+135
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+135
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+135
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '1', storedetaildate = '2026-10-19 14:23:42' WHERE storedetailid = '567';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('567', '1', '3', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '87', '1', '2026-10-19 14:23:42','0','0'); -- id=4851
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '343', '6', '527', '1', '23', '23', '0', '', '1', '2026-10-19 14:23:42', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=2746
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 2746;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2026-10-19 14:23:42' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '11', '1', '2026-10-19 14:23:42','0','0'); -- id=4852
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '343', '14', '81', '2', '19', '38', '0', '', '1', '2026-10-19 14:23:42', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=2747
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2747;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '1', storedetaildate = '2026-10-19 14:23:43' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '343', 'اضافة فاتورة مبيعات', 'sellbillController.php', '58', '56', '1', '2026-10-19 14:23:43','0','0'); -- id=4853
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-806452.5125',  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 ('-812165.0625','5712.55', '0', '1', 'اضافة فاتورة مبيعات', '343', '-806452.5125', '2026-10-19 14:23:43', '1',  'sellbillController.php','1','','0'); -- id=358
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5712.55', '5712.55', '2026-10-19', '1', '0', '0', '2026-10-19 14:23:43','اضافة فاتورة مبيعات رقم 343','1','0',null,'0','343','sellbillController.php?do=showDetail&sellbillid=343'); -- id=1771
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1771', '383', '5712.55', '','0'); -- id=1787
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '177012.29', 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 ('1771', '143', '5712.55', '','0'); -- id=1775
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1522140.35', 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 ( '4864.61', '4864.61', '2026-10-19', '1', '0', '0', '2026-10-19 14:23:43','اضافة فاتورة مبيعات رقم 343 - صرف البضاعة من المخزن','1','0',null,'0','343','sellbillController.php?do=showDetail&sellbillid=343'); -- id=1772
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1772', '402', '4864.61', '','0'); -- id=1788
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1358650.65', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1772', '382', '4864.61', '','0'); -- id=1776
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2187907.95', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1771,0,1772' where sellbillid=343;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 5712.55, 5039.61, 4864.61
                    , 4953.41, 4864.61, 4953.41, 4864.61
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4952.11, 4953.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5712.55, sellCostBuyPrice =sellCostBuyPrice+5039.61
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4864.61, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4953.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4864.61, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4953.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4864.61
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4952.11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4953.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 5712.55, 5039.61, 4864.61
                    , 4953.41, 4864.61, 4953.41, 4864.61
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4952.11, 4953.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5712.55, sellCostBuyPrice =sellCostBuyPrice+5039.61
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4864.61, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4953.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4864.61, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4953.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4864.61
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4952.11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4953.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5712.55, 5039.61, 4864.61
                    , 4953.41, 4864.61, 4953.41, 4864.61, 4952.11, 4953.41)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5712.55, netSellCostBuyPrice = netSellCostBuyPrice+5039.61
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4864.61
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4953.41
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4864.61
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4953.41
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4864.61
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4952.11
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4953.41;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad609fb0d54d and sellbillId = 343 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:53:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:23:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:23:45', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4596
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:58:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:28:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:28:14', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4597
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:58:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:28:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:28:24', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4598
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:58:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:28:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:28:30', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=343'); -- id=4599
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:58:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:28:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:28:41', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4600
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 343;
UPDATE sellbill SET  sellbillsysdate = '2026-10-19 14:28:41', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '343';
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2732;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 75, 70.8, 70.8
                    , 70.8, 70.8, 70.8, 70.8
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 70.8, 70.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-75, sellCostBuyPrice =sellCostBuyPrice-70.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-70.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-70.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-70.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-70.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-70.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-70.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70.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-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 75, 70.8, 70.8
                    , 70.8, 70.8, 70.8, 70.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70.8, 70.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-75, sellCostBuyPrice =sellCostBuyPrice-70.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-70.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice-70.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-70.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-70.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-70.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-70.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-70.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 = '453', userid = '1', storedetaildate = '2026-10-19 14:28:41' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '12', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '441', '453', '1', '2026-10-19 14:23:36','0','0'); -- id=4854
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 = 2733;
 INSERT INTO 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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-22.6, sellCostBuyPrice =sellCostBuyPrice-22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-22.6, sellCostBuyPrice =sellCostBuyPrice-22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.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 = '148', userid = '1', storedetaildate = '2026-10-19 14:28:41' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '2', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '146', '148', '1', '2026-10-19 14:23:36','0','0'); -- id=4855
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 = 2734;
 INSERT INTO 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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-22.6, sellCostBuyPrice =sellCostBuyPrice-22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-22.6, sellCostBuyPrice =sellCostBuyPrice-22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice-22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-22.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 = '96', userid = '1', storedetaildate = '2026-10-19 14:28:41' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '2', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '94', '96', '1', '2026-10-19 14:23:36','0','0'); -- id=4856
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2735;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-102, sellCostBuyPrice =sellCostBuyPrice-92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-92.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-102, sellCostBuyPrice =sellCostBuyPrice-92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-92.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '280', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '277', '280', '1', '2026-10-19 14:23:36','0','0'); -- id=4857
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 48;
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2736;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-40.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-45, sellCostBuyPrice =sellCostBuyPrice-39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice-40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-40.9
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '231', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '230', '231', '1', '2026-10-19 14:23:36','0','0'); -- id=4858
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 100;
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 160.00
        , lastbuyprice_withTax = 160, meanbuyprice_withTax = 160, lastbuyprice_withDiscountAndTax = 160
                where sellbilldetailid = 2737;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (84, '2026-10-19', 195, 160, 160
                    , 160, 160, 160, 160
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 160, 160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-195, sellCostBuyPrice =sellCostBuyPrice-160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 195, 160, 160
                    , 160, 160, 160, 160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 160, 160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-195, sellCostBuyPrice =sellCostBuyPrice-160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-160, sellCostMeanBuyPrice = sellCostMeanBuyPrice-160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-160
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = 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-10-19 14:28:42' WHERE storedetailid = '84';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('84', '1', '1', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '50', '51', '1', '2026-10-19 14:23:36','0','0'); -- id=4859
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1040.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1040.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1040, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 2738;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (259, '2026-10-19', 1295, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1295, sellCostBuyPrice =sellCostBuyPrice-1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1040
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1295, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1295, sellCostBuyPrice =sellCostBuyPrice-1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1040
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '259';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('259', '1', '1', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '2', '3', '1', '2026-10-19 14:23:36','0','0'); -- id=4860
UPDATE sellbilldetail SET  lastbuyprice = 2000.00 , meanbuyprice = 2087.50, lastbuyprice_withDiscount = 2000.00, meanbuyprice_withDiscount = 2087.50
        , lastbuyprice_withTax = 2087.5, meanbuyprice_withTax = 2087.5, lastbuyprice_withDiscountAndTax = 2000
                where sellbilldetailid = 2739;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-19', 2395, 2175, 2000
                    , 2087.5, 2000, 2087.5, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2087.5, 2087.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2395, sellCostBuyPrice =sellCostBuyPrice-2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2087.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2087.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2087.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2087.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2395, 2175, 2000
                    , 2087.5, 2000, 2087.5, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2087.5, 2087.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2395, sellCostBuyPrice =sellCostBuyPrice-2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2087.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2087.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2087.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2087.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 = '35', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '34', '35', '1', '2026-10-19 14:23:36','0','0'); -- id=4861
UPDATE sellbilldetail SET  lastbuyprice = 144.00 , meanbuyprice = 144.00, lastbuyprice_withDiscount = 144.00, meanbuyprice_withDiscount = 144.00
        , lastbuyprice_withTax = 144, meanbuyprice_withTax = 144, lastbuyprice_withDiscountAndTax = 144
                where sellbilldetailid = 2740;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (157, '2026-10-19', 960, 864, 864
                    , 864, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 864, 864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-960, sellCostBuyPrice =sellCostBuyPrice-864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-864, sellCostMeanBuyPrice = sellCostMeanBuyPrice-864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-864
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 960, 864, 864
                    , 864, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 864, 864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-960, sellCostBuyPrice =sellCostBuyPrice-864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-864, sellCostMeanBuyPrice = sellCostMeanBuyPrice-864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-864
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '47', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '157';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('157', '1', '6', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '41', '47', '1', '2026-10-19 14:23:36','0','0'); -- id=4862
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-13 where id = 203;
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 = 2741;
 INSERT INTO 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-10-19', 189.8, 182, 182
                    , 182, 182, 182, 182
                    , 0, 0, 0, 0
                    , 0, 0, 0,13,0, 182, 182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-189.8, sellCostBuyPrice =sellCostBuyPrice-182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-182, sellCostMeanBuyPrice = sellCostMeanBuyPrice-182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-182
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-13
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 189.8, 182, 182
                    , 182, 182, 182, 182
                    , 0, 0, 0, 0
                    , 0, 0, 0, 182, 182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-189.8, sellCostBuyPrice =sellCostBuyPrice-182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-182, sellCostMeanBuyPrice = sellCostMeanBuyPrice-182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-182
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '181', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '13', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '168', '181', '1', '2026-10-19 14:23:36','0','0'); -- id=4863
UPDATE sellbilldetail SET  lastbuyprice = 25.00 , meanbuyprice = 25.00, lastbuyprice_withDiscount = 25.00, meanbuyprice_withDiscount = 25.00
        , lastbuyprice_withTax = 25, meanbuyprice_withTax = 25, lastbuyprice_withDiscountAndTax = 25
                where sellbilldetailid = 2742;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (312, '2026-10-19', 26, 25, 25
                    , 25, 25, 25, 25
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 25, 25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-26, sellCostBuyPrice =sellCostBuyPrice-25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-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-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 26, 25, 25
                    , 25, 25, 25, 25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-26, sellCostBuyPrice =sellCostBuyPrice-25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-25, sellCostMeanBuyPrice = sellCostMeanBuyPrice-25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-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 = '24', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '312';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('312', '1', '1', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '23', '24', '1', '2026-10-19 14:23:36','0','0'); -- id=4864
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-22 where id = 204;
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.00, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.00
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 2743;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (368, '2026-10-19', 165, 154, 154
                    , 154, 154, 154, 154
                    , 0, 0, 0, 0
                    , 0, 0, 0,22,0, 154, 154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-154, sellCostMeanBuyPrice = sellCostMeanBuyPrice-154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-154
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-22
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 165, 154, 154
                    , 154, 154, 154, 154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 154, 154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-165, sellCostBuyPrice =sellCostBuyPrice-154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-154, sellCostMeanBuyPrice = sellCostMeanBuyPrice-154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-154
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '339', userid = '1', storedetaildate = '2026-10-19 14:28:42' WHERE storedetailid = '368';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('368', '1', '22', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '317', '339', '1', '2026-10-19 14:23:36','0','0'); -- id=4865
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 205;
UPDATE sellbilldetail SET  lastbuyprice = 2.41 , meanbuyprice = 2.41, lastbuyprice_withDiscount = 2.41, meanbuyprice_withDiscount = 2.41
        , lastbuyprice_withTax = 2.41, meanbuyprice_withTax = 2.41, lastbuyprice_withDiscountAndTax = 2.41
                where sellbilldetailid = 2744;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (313, '2026-10-19', 2.55, 2.41, 2.41
                    , 2.41, 2.41, 2.41, 2.41
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 2.41, 2.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2.55, sellCostBuyPrice =sellCostBuyPrice-2.41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2.41, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2.41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2.41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2.41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2.41
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2.55, 2.41, 2.41
                    , 2.41, 2.41, 2.41, 2.41
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2.41, 2.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2.55, sellCostBuyPrice =sellCostBuyPrice-2.41
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2.41, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2.41, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2.41
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2.41
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2.41
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '750', userid = '1', storedetaildate = '2026-10-19 14:28:43' WHERE storedetailid = '313';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('313', '1', '1', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '749', '750', '1', '2026-10-19 14:23:36','0','0'); -- id=4866
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 164;
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 2745;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (567, '2026-10-19', 156, 135, 135
                    , 135, 135, 135, 135
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 135, 135, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-156, sellCostBuyPrice =sellCostBuyPrice-135
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-135, sellCostMeanBuyPrice = sellCostMeanBuyPrice-135
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-135, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-135
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-135
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-135
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-135
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 156, 135, 135
                    , 135, 135, 135, 135
                    , 0, 0, 0, 0
                    , 0, 0, 0, 135, 135, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-156, sellCostBuyPrice =sellCostBuyPrice-135
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-135, sellCostMeanBuyPrice = sellCostMeanBuyPrice-135
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-135, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-135
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-135
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-135
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-135
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '90', userid = '1', storedetaildate = '2026-10-19 14:28:43' WHERE storedetailid = '567';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('567', '1', '3', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '87', '90', '1', '2026-10-19 14:23:36','0','0'); -- id=4867
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 2746;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-23, sellCostBuyPrice =sellCostBuyPrice-19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-19 14:28:43' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '11', '12', '1', '2026-10-19 14:23:36','0','0'); -- id=4868
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2747;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 14:28:43' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '0', '343', 'تعديل فاتورة مبيعات', 'sellbillController.php', '56', '58', '1', '2026-10-19 14:23:36','0','0'); -- id=4869
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','تعديل فاتورة مبيعات','343', '0', '2026-10-19 14:23:36', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '5712.55', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 14:23:36','0','0','',''); -- id=584
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-812165.05',  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 ('-806452.5','5712.55', '1', '1', 'تعديل فاتورة مبيعات', '343', '-812165.05', '2026-10-19 14:28:43', '1',  'sellbillController.php','1','','0'); -- id=359
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 5712.55, 5039.61, 4864.61
                    , 4953.41, 4864.61, 4953.41, 4864.61
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4952.11, 4953.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5712.55, sellCostBuyPrice =sellCostBuyPrice-5039.61
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4864.61, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4953.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4864.61, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4953.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4864.61
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4952.11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4953.41
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 5712.55, 5039.61, 4864.61
                    , 4953.41, 4864.61, 4953.41, 4864.61
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4952.11, 4953.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-5712.55, sellCostBuyPrice =sellCostBuyPrice-5039.61
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4864.61, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4953.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4864.61, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4953.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4864.61
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4952.11
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4953.41
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5712.55, 5039.61, 4864.61
                    , 4953.41, 4864.61, 4953.41, 4864.61, 4952.11, 4953.41)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-5712.55, netSellCostBuyPrice = netSellCostBuyPrice-5039.61
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-4864.61
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-4953.41
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-4864.61
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-4953.41
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-4864.61
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-4952.11
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-4953.41;

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


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 343 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-10-19 14:23:36', '06ad609fb0d54d', '1', '0.00', '0', '0', '1', '5786.5', '5786.5', '5786.5', '0', '1', '2026-10-19 14:23:36', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '101', '343', 'sellbillController', '0','','','','','-1','0','0','5786.5','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=344
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','اضافة فاتورة مبيعات (معدله)','344', '0', '2026-10-19 14:28:44', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '5786.5', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 14:23:36','0','0','',''); -- id=585
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '344', '12', '86', '12.00', '6.25', '75', '0', '', '1', '2026-10-19 14:28:44', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','6.25','75','0','','0','0.00','0','0','0','0'); -- id=2748
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2748;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 75, 70.8, 70.8
                    , 70.8, 70.8, 70.8, 70.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 70.8, 70.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+70.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70.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+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 75, 70.8, 70.8
                    , 70.8, 70.8, 70.8, 70.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 70.8, 70.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+75, sellCostBuyPrice =sellCostBuyPrice+70.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+70.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+70.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+70.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+70.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+70.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+70.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+70.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 = '441', userid = '1', storedetaildate = '2026-10-19 14:28:44' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '12', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '453', '441', '1', '2026-10-19 14:28:44','0','0'); -- id=4870
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '344', '12', '87', '2.00', '11.3', '22.6', '0', '', '1', '2026-10-19 14:28:44', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','22.6','0','','0','0.00','0','0','0','0'); -- id=2749
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 = 2749;
 INSERT INTO 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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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 = '146', userid = '1', storedetaildate = '2026-10-19 14:28:45' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '2', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '148', '146', '1', '2026-10-19 14:28:45','0','0'); -- id=4871
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '344', '12', '88', '2.00', '11.3', '22.6', '0', '', '1', '2026-10-19 14:28:45', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','11.3','22.6','0','','0','0.00','0','0','0','0'); -- id=2750
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 = 2750;
 INSERT INTO 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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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-10-19', 22.6, 22.2, 22.2
                    , 22.2, 22.2, 22.2, 22.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22.2, 22.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22.6, sellCostBuyPrice =sellCostBuyPrice+22.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+22.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 = '94', userid = '1', storedetaildate = '2026-10-19 14:28:45' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '2', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '96', '94', '1', '2026-10-19 14:28:45','0','0'); -- id=4872
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '344', '12', '82', '3.00', '34', '102', '0', '', '1', '2026-10-19 14:28:45', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','47-3,','1','1','0','0','34','102','0','','0','0.00','0','0','0','0'); -- id=2751
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2751;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-10-19 14:28:45' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '280', '277', '1', '2026-10-19 14:28:45','0','0'); -- id=4873
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '344', '12', '83', '1.00', '45', '45', '0', '', '1', '2026-10-19 14:28:45', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','48-1,','1','1','0','0','45','45','0','','0','0.00','0','0','0','0'); -- id=2752
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2752;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 45, 39.6, 39.6
                    , 40.9, 39.6, 40.9, 39.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 39.6, 40.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+45, sellCostBuyPrice =sellCostBuyPrice+39.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+39.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+39.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '230', userid = '1', storedetaildate = '2026-10-19 14:28:45' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '1', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '231', '230', '1', '2026-10-19 14:28:46','0','0'); -- id=4874
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 100;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('160','00084', '344', '12', '84', '1.00', '195', '195', '0', '', '1', '2026-10-19 14:28:46', '84', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','100-1,','1','1','0','0','195','195','0','','0','0.00','0','0','0','0'); -- id=2753
UPDATE sellbilldetail SET  lastbuyprice = 160.00 , meanbuyprice = 160.00, lastbuyprice_withDiscount = 160.00, meanbuyprice_withDiscount = 160.00
        , lastbuyprice_withTax = 160, meanbuyprice_withTax = 160, lastbuyprice_withDiscountAndTax = 160
                where sellbilldetailid = 2753;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (84, '2026-10-19', 195, 160, 160
                    , 160, 160, 160, 160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 160, 160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, sellCostBuyPrice =sellCostBuyPrice+160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 195, 160, 160
                    , 160, 160, 160, 160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 160, 160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+195, sellCostBuyPrice =sellCostBuyPrice+160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-19 14:28:46' WHERE storedetailid = '84';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('84', '1', '1', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '51', '50', '1', '2026-10-19 14:28:46','0','0'); -- id=4875
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1040','00259', '344', '10', '259', '1.00', '1295', '1295', '0', '', '1', '2026-10-19 14:28:46', '259', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','1295','1295','0','','0','0.00','0','0','0','0'); -- id=2754
UPDATE sellbilldetail SET  lastbuyprice = 1040.00 , meanbuyprice = 1040.00, lastbuyprice_withDiscount = 1040.00, meanbuyprice_withDiscount = 1040.00
        , lastbuyprice_withTax = 1040, meanbuyprice_withTax = 1040, lastbuyprice_withDiscountAndTax = 1040
                where sellbilldetailid = 2754;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (259, '2026-10-19', 1295, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1295, sellCostBuyPrice =sellCostBuyPrice+1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1295, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1295, sellCostBuyPrice =sellCostBuyPrice+1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2', userid = '1', storedetaildate = '2026-10-19 14:28:46' WHERE storedetailid = '259';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('259', '1', '1', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '3', '2', '1', '2026-10-19 14:28:46','0','0'); -- id=4876
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('2175','00251', '344', '10', '251', '1.00', '2395', '2395', '0', '', '1', '2026-10-19 14:28:46', '251', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','2395','2395','0','','0','0.00','0','0','0','0'); -- id=2755
UPDATE sellbilldetail SET  lastbuyprice = 2000.00 , meanbuyprice = 2087.50, lastbuyprice_withDiscount = 2000.00, meanbuyprice_withDiscount = 2087.50
        , lastbuyprice_withTax = 2087.5, meanbuyprice_withTax = 2087.5, lastbuyprice_withDiscountAndTax = 2000
                where sellbilldetailid = 2755;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (251, '2026-10-19', 2395, 2175, 2000
                    , 2087.5, 2000, 2087.5, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 2087.5, 2087.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2395, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2087.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2087.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2087.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2087.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2395, 2175, 2000
                    , 2087.5, 2000, 2087.5, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2087.5, 2087.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2395, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2087.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2087.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2087.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2087.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 = '34', userid = '1', storedetaildate = '2026-10-19 14:28:47' WHERE storedetailid = '251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('251', '1', '1', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '35', '34', '1', '2026-10-19 14:28:47','0','0'); -- id=4877
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('144','00157', '344', '22', '157', '6.00', '160', '960', '0', '', '1', '2026-10-19 14:28:47', '157', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','160','960','0','','0','0.00','0','0','0','0'); -- id=2756
UPDATE sellbilldetail SET  lastbuyprice = 144.00 , meanbuyprice = 144.00, lastbuyprice_withDiscount = 144.00, meanbuyprice_withDiscount = 144.00
        , lastbuyprice_withTax = 144, meanbuyprice_withTax = 144, lastbuyprice_withDiscountAndTax = 144
                where sellbilldetailid = 2756;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (157, '2026-10-19', 960, 864, 864
                    , 864, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 864, 864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+864, sellCostMeanBuyPrice = sellCostMeanBuyPrice+864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+864
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 960, 864, 864
                    , 864, 864, 864, 864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 864, 864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+864, sellCostMeanBuyPrice = sellCostMeanBuyPrice+864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+864
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '41', userid = '1', storedetaildate = '2026-10-19 14:28:47' WHERE storedetailid = '157';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('157', '1', '6', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '47', '41', '1', '2026-10-19 14:28:47','0','0'); -- id=4878
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+13 where id = 203;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '344', '4', '279', '13.00', '14.6', '189.79999999999998', '0', '', '1', '2026-10-19 14:28:47', '279', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','203-13,','1','1','0','0','14.6','189.8','0','','0','0.00','0','0','0','0'); -- id=2757
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 = 2757;
 INSERT INTO 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-10-19', 189.8, 182, 182
                    , 182, 182, 182, 182
                    , 0, 0, 0, 0
                    , 0, 0, 0, 13, 0, 182, 182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.8, sellCostBuyPrice =sellCostBuyPrice+182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+182, sellCostMeanBuyPrice = sellCostMeanBuyPrice+182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+182
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+13
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 189.8, 182, 182
                    , 182, 182, 182, 182
                    , 0, 0, 0, 0
                    , 0, 0, 0, 182, 182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+189.8, sellCostBuyPrice =sellCostBuyPrice+182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+182, sellCostMeanBuyPrice = sellCostMeanBuyPrice+182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+182
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '168', userid = '1', storedetaildate = '2026-10-19 14:28:47' WHERE storedetailid = '279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('279', '1', '13', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '181', '168', '1', '2026-10-19 14:28:47','0','0'); -- id=4879
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('25','00312', '344', '4', '312', '1.00', '26', '26', '0', '', '1', '2026-10-19 14:28:47', '312', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','26','26','0','','0','0.00','0','0','0','0'); -- id=2758
UPDATE sellbilldetail SET  lastbuyprice = 25.00 , meanbuyprice = 25.00, lastbuyprice_withDiscount = 25.00, meanbuyprice_withDiscount = 25.00
        , lastbuyprice_withTax = 25, meanbuyprice_withTax = 25, lastbuyprice_withDiscountAndTax = 25
                where sellbilldetailid = 2758;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (312, '2026-10-19', 26, 25, 25
                    , 25, 25, 25, 25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 25, 25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26, sellCostBuyPrice =sellCostBuyPrice+25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 26, 25, 25
                    , 25, 25, 25, 25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 25, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26, sellCostBuyPrice =sellCostBuyPrice+25
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+25, sellCostMeanBuyPrice = sellCostMeanBuyPrice+25
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+25
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+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 = '23', userid = '1', storedetaildate = '2026-10-19 14:28:48' WHERE storedetailid = '312';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('312', '1', '1', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '24', '23', '1', '2026-10-19 14:28:48','0','0'); -- id=4880
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+22 where id = 204;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00368', '344', '4', '368', '22.00', '7.5', '165', '0', '', '1', '2026-10-19 14:28:48', '368', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','204-22,','1','1','0','0','7.5','165','0','','0','0.00','0','0','0','0'); -- id=2759
UPDATE sellbilldetail SET  lastbuyprice = 7.00 , meanbuyprice = 7.00, lastbuyprice_withDiscount = 7.00, meanbuyprice_withDiscount = 7.00
        , lastbuyprice_withTax = 7, meanbuyprice_withTax = 7, lastbuyprice_withDiscountAndTax = 7
                where sellbilldetailid = 2759;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (368, '2026-10-19', 165, 154, 154
                    , 154, 154, 154, 154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 22, 0, 154, 154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+22
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 165, 154, 154
                    , 154, 154, 154, 154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 154, 154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+165, sellCostBuyPrice =sellCostBuyPrice+154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '317', userid = '1', storedetaildate = '2026-10-19 14:28:48' WHERE storedetailid = '368';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('368', '1', '22', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '339', '317', '1', '2026-10-19 14:28:48','0','0'); -- id=4881
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+30 where id = 205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.41','00313', '344', '4', '313', '30', '2.55', '76.5', '0', '', '1', '2026-10-19 14:28:48', '313', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','205-30,','1','1','0','0','2.55','76.5','0','','0','0.00','0','0','0','0'); -- id=2760
UPDATE sellbilldetail SET  lastbuyprice = 2.41 , meanbuyprice = 2.41, lastbuyprice_withDiscount = 2.41, meanbuyprice_withDiscount = 2.41
        , lastbuyprice_withTax = 2.41, meanbuyprice_withTax = 2.41, lastbuyprice_withDiscountAndTax = 2.41
                where sellbilldetailid = 2760;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (313, '2026-10-19', 76.5, 72.3, 72.3
                    , 72.3, 72.3, 72.3, 72.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 0, 72.3, 72.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+76.5, sellCostBuyPrice =sellCostBuyPrice+72.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+72.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+30
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 76.5, 72.3, 72.3
                    , 72.3, 72.3, 72.3, 72.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 72.3, 72.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+76.5, sellCostBuyPrice =sellCostBuyPrice+72.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+72.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+72.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+72.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+72.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+72.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+72.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+72.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 = '720', userid = '1', storedetaildate = '2026-10-19 14:28:48' WHERE storedetailid = '313';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('313', '1', '30', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '750', '720', '1', '2026-10-19 14:28:48','0','0'); -- id=4882
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 164;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('45','00567', '344', '9', '567', '3.00', '52', '156', '0', '', '1', '2026-10-19 14:28:48', '567', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','164-3,','1','1','0','0','52','156','0','','0','0.00','0','0','0','0'); -- id=2761
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 2761;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (567, '2026-10-19', 156, 135, 135
                    , 135, 135, 135, 135
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 135, 135, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+135
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+135, sellCostMeanBuyPrice = sellCostMeanBuyPrice+135
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+135, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+135
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+135
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+135
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+135
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 156, 135, 135
                    , 135, 135, 135, 135
                    , 0, 0, 0, 0
                    , 0, 0, 0, 135, 135, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+156, sellCostBuyPrice =sellCostBuyPrice+135
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+135, sellCostMeanBuyPrice = sellCostMeanBuyPrice+135
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+135, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+135
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+135
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+135
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+135
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '1', storedetaildate = '2026-10-19 14:28:49' WHERE storedetailid = '567';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('567', '1', '3', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '90', '87', '1', '2026-10-19 14:28:49','0','0'); -- id=4883
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('19','00527', '344', '6', '527', '1.00', '23', '23', '0', '', '1', '2026-10-19 14:28:49', '527', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','23','23','0','','0','0.00','0','0','0','0'); -- id=2762
UPDATE sellbilldetail SET  lastbuyprice = 19.00 , meanbuyprice = 19.00, lastbuyprice_withDiscount = 19.00, meanbuyprice_withDiscount = 19.00
        , lastbuyprice_withTax = 19, meanbuyprice_withTax = 19, lastbuyprice_withDiscountAndTax = 19
                where sellbilldetailid = 2762;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (527, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 23, 19, 19
                    , 19, 19, 19, 19
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19, 19, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23, sellCostBuyPrice =sellCostBuyPrice+19
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2026-10-19 14:28:49' WHERE storedetailid = '527';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('527', '1', '1', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '12', '11', '1', '2026-10-19 14:28:49','0','0'); -- id=4884
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '344', '14', '81', '2.00', '19', '38', '0', '', '1', '2026-10-19 14:28:49', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=2763
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2763;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36, 36
                    , 36, 36, 36, 36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36, 36, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '1', storedetaildate = '2026-10-19 14:28:49' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '2', '1', '344', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '56', '1', '2026-10-19 14:28:49','0','0'); -- id=4885
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-806378.5625',  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 ('-812165.0625','5786.5', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '344', '-806378.5625', '2026-10-19 14:28:49', '1',  'sellbillController.php','1','','0'); -- id=360
UPDATE dailyentry SET totalcreditor = '5712.55', totaldebtor = '5712.55', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 14:23:43', entryComment = 'اضافة فاتورة مبيعات رقم 343', fromFlag = '1',related='0',isopeningentry='0',operationId='343',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=343' WHERE id = '1771';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5712.55', '5712.55', '2026-10-19', '1', '0', '1771', '2026-10-19 14:28:50','تم عكس القيد رقم 1771 ','1','0','0','0','0',''); -- id=1773
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1773', '383', '5712.55', '','0'); -- id=1777
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '171299.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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1773', '143', '5712.55', '','0'); -- id=1789
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1516427.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 = '4864.61', totaldebtor = '4864.61', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 14:23:43', entryComment = 'اضافة فاتورة مبيعات رقم 343 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='343',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=343' WHERE id = '1772';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4864.61', '4864.61', '2026-10-19', '1', '0', '1772', '2026-10-19 14:28:50','تم عكس القيد رقم 1772 ','1','0','0','0','0',''); -- id=1774
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1774', '402', '4864.61', '','0'); -- id=1778
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1353786.04', 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 ('1774', '382', '4864.61', '','0'); -- id=1790
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2192772.56', 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 ( '5786.5', '5786.5', '2026-10-19', '1', '0', '0', '2026-10-19 14:28:51','اضافة فاتورة مبيعات رقم 344','1','0',null,'0','344','sellbillController.php?do=showDetail&sellbillid=344'); -- id=1775
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1775', '383', '5786.5', '','0'); -- id=1791
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '177086.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 ('1775', '143', '5786.5', '','0'); -- id=1779
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1522214.3', 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 ( '4934.5', '4934.5', '2026-10-19', '1', '0', '0', '2026-10-19 14:28:51','اضافة فاتورة مبيعات رقم 344 - صرف البضاعة من المخزن','1','0',null,'0','344','sellbillController.php?do=showDetail&sellbillid=344'); -- id=1776
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1776', '402', '4934.5', '','0'); -- id=1792
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1358720.54', 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 ('1776', '382', '4934.5', '','0'); -- id=1780
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2187838.06', 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='1775,0,1776' where sellbillid=344;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 5786.5, 5109.5, 4934.5
                    , 5023.3, 4934.5, 5023.3, 4934.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5022, 5023.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5786.5, sellCostBuyPrice =sellCostBuyPrice+5109.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4934.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5023.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4934.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5023.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4934.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5022
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5023.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 (1, '2026-10-19', 5786.5, 5109.5, 4934.5
                    , 5023.3, 4934.5, 5023.3, 4934.5
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5022, 5023.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5786.5, sellCostBuyPrice =sellCostBuyPrice+5109.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4934.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5023.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4934.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5023.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4934.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5022
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5023.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, 5786.5, 5109.5, 4934.5
                    , 5023.3, 4934.5, 5023.3, 4934.5, 5022, 5023.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5786.5, netSellCostBuyPrice = netSellCostBuyPrice+5109.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4934.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5023.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4934.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5023.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4934.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5022
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5023.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 343 and newid=344 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 10:58:52";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:28:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:28:52', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=344'); -- id=4601
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:08:35";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:38:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:38:35', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4602
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:08:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:38:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:38:47', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4603
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:08:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:38:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:38:51', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=344'); -- id=4604
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:16:30";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:46:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 14:46:30', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4605
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:25:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:55:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 14:55:05', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4606
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:27:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:57:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 14:57:01', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4607
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('لفه سوسته وير 30 متر ','','6','190','205','205','205','2026-10-19','0','1','0','','0','0','0','0','0','190','190','190','190','190','0','7.89','7.89','7.89','.','0','0','0','190','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','190','190','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','190','0','0','0','0','0','0','','','0','0','0','0'); -- id=607
UPDATE product SET productName = 'لفه سوسته وير 30 متر ', productDescription = '', productCatId = '6', productBuyPrice = '190', productSellAllPrice = '205', productSellUnitPrice = '205', productSellHalfPrice = '205', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00607',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '7.89' , buyhalf_precentage = '7.89' , buypart_precentage = '7.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='190',meanbuyprice_withTax='190',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='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '607';
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', '607', '1.00', '2026-10-19', '1', '0','0060701','205','205','205','190','','0','0','0','0','0','0','0','0','0','0'); -- id=607
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('607', '1', '0', '1', '2026-10-19'); -- id=607
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('607', '1', '0', '0', '607', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-19','0','0'); -- id=4886
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (607, 1,'2026-10-19 14:57:02',1)
                ON DUPLICATE KEY UPDATE productid = 607, edited = 1, sysdate = '2026-10-19 14:57:02', userid = 1; -- id=809
UPDATE product SET productName = 'لفه سوسته وير 30 متر ', productDescription = '', productCatId = '6', productBuyPrice = '190.00', productSellAllPrice = '205.00', productSellUnitPrice = '205.00', productSellHalfPrice = '205.00', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00607',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '190',lastbuyprice_withDiscount = '190',meanbuyprice = '190',meanbuyprice_withDiscount = '190' , productbuypricereal = '190' , buypricereal_precentage = '0' , buytotal_precentage = '7.89' , buyhalf_precentage = '7.89' , buypart_precentage = '7.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='190',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='190',meanbuyprice_withTax='190',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='190',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '607';
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 ('لفه سوسته وير 40 متر ','','6','250','265','265','265','2026-10-19','0','1','0','','0','0','0','0','0','250','250','250','250','250','0','6','6','6','.','0','0','0','250','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','250','250','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','250','0','0','0','0','0','0','','','0','0','0','0'); -- id=608
UPDATE product SET productName = 'لفه سوسته وير 40 متر ', productDescription = '', productCatId = '6', productBuyPrice = '250', productSellAllPrice = '265', productSellUnitPrice = '265', productSellHalfPrice = '265', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00608',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '250',lastbuyprice_withDiscount = '250',meanbuyprice = '250',meanbuyprice_withDiscount = '250' , productbuypricereal = '250' , buypricereal_precentage = '0' , buytotal_precentage = '6' , buyhalf_precentage = '6' , buypart_precentage = '6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='250',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='250',meanbuyprice_withTax='250',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='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 = '608';
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', '608', '1.00', '2026-10-19', '1', '0','0060801','265','265','265','250','','0','0','0','0','0','0','0','0','0','0'); -- id=608
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('608', '1', '5', '1', '2026-10-19'); -- id=608
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('608', '1', '5', '0', '608', 'إضافة منتج', 'productController.php', '0', '5', '1', '2026-10-19','0','0'); -- id=4887
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (608, 1,'2026-10-19 14:57:03',1)
                ON DUPLICATE KEY UPDATE productid = 608, edited = 1, sysdate = '2026-10-19 14:57:03', userid = 1; -- id=810
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1250', '1250', '2026-10-19', '1', '0', '0', '2026-10-19 14:57:03','إضافة منتج لفه سوسته وير 40 متر  الكمية 5','1','0','0','0','608','productController.php?do=edit&id=608'); -- id=1777
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1777', '382', '1250', '','0'); -- id=1793
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2189088.06', 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 ('1777', '121', '1250', '','0'); -- id=1781
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1851489.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لفه سوسته وير 40 متر ', productDescription = '', productCatId = '6', productBuyPrice = '250.00', productSellAllPrice = '265.00', productSellUnitPrice = '265.00', productSellHalfPrice = '265.00', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00608',type ='0', expireDate = '0' , dailyentryId = '1777',isService = '0',isOptic = '0',lastbuyprice = '250',lastbuyprice_withDiscount = '250',meanbuyprice = '250',meanbuyprice_withDiscount = '250' , productbuypricereal = '250' , buypricereal_precentage = '0' , buytotal_precentage = '6' , buyhalf_precentage = '6' , buypart_precentage = '6',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='250',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='250',meanbuyprice_withTax='250',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='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 = '608';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:27:06";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 14:57:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 14:57:06', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4608
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:32:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:02:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:02:22', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4609

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad61127ad6e2
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 15:02:22', '06ad61127ad6e2', '1', '0.00', '0', '0', '1', '3806.60', '3806.6', '3806.6', '0', '1', '2026-10-19 15:02:22', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '108' ,'0','','','','','-1','0','0','0','0','0','3806','0','','0','0','3806.6','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=345
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','اضافة فاتورة مبيعات','345', '0', '2026-10-19 15:02:23', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3806.6', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 15:02:22','0','0','',''); -- id=586
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 107;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1068.75','00524', '345', '6', '524', '1', '1026', '1026', '0', '', '0', '2026-10-19 15:02:23', '524', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','107-1,','1','1','0','0','1026','1026','0','','0','','0','0','0','0'); -- id=2764
UPDATE sellbilldetail SET  lastbuyprice = 999.00 , meanbuyprice = 1025.16, lastbuyprice_withDiscount = 999.00, meanbuyprice_withDiscount = 1025.16
        , lastbuyprice_withTax = 999, meanbuyprice_withTax = 1025.16, lastbuyprice_withDiscountAndTax = 999
                where sellbilldetailid = 2764;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (524, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1026, sellCostBuyPrice =sellCostBuyPrice+999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+999, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1025.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1026, sellCostBuyPrice =sellCostBuyPrice+999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+999, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1025.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-19 15:02:23' WHERE storedetailid = '524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('524', '1', '1', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '15', '1', '2026-10-19 15:02:23','0','0'); -- id=4888
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '345', '12', '86', '50', '6.25', '312.5', '0', '', '0', '2026-10-19 15:02:23', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','6.25','312.5','0','','0','0.00','0','0','0','0'); -- id=2765
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2765;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312.5, sellCostBuyPrice =sellCostBuyPrice+295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+295
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312.5, sellCostBuyPrice =sellCostBuyPrice+295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+295
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '391', userid = '1', storedetaildate = '2026-10-19 15:02:23' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '50', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '441', '391', '1', '2026-10-19 15:02:23','0','0'); -- id=4889
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '345', '12', '87', '25', '11.3', '282.5', '0', '', '0', '2026-10-19 15:02:24', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11.3','282.5','0','','0','0.00','0','0','0','0'); -- id=2766
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 = 2766;
 INSERT INTO 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-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+282.5, sellCostBuyPrice =sellCostBuyPrice+277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+277.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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+282.5, sellCostBuyPrice =sellCostBuyPrice+277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+277.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 = '121', userid = '1', storedetaildate = '2026-10-19 15:02:24' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '25', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '146', '121', '1', '2026-10-19 15:02:24','0','0'); -- id=4890
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '345', '12', '88', '7', '11.3', '79.10000000000001', '0', '', '0', '2026-10-19 15:02:24', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11.3','79.1','0','','0','0.00','0','0','0','0'); -- id=2767
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 = 2767;
 INSERT INTO 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-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79.1, sellCostBuyPrice =sellCostBuyPrice+77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.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+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79.1, sellCostBuyPrice =sellCostBuyPrice+77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.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 = '87', userid = '1', storedetaildate = '2026-10-19 15:02:24' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '7', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '94', '87', '1', '2026-10-19 15:02:24','0','0'); -- id=4891
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '345', '12', '83', '5', '44', '220', '0', '', '0', '2026-10-19 15:02:24', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','48-5,','1','1','0','0','44','220','0','','0','0.00','0','0','0','0'); -- id=2768
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2768;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '225', userid = '1', storedetaildate = '2026-10-19 15:02:25' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '5', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '230', '225', '1', '2026-10-19 15:02:25','0','0'); -- id=4892
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '345', '12', '82', '3', '34', '102', '0', '', '0', '2026-10-19 15:02:25', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-3,','1','1','0','0','34','102','0','','0','0.00','0','0','0','0'); -- id=2769
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2769;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '274', userid = '1', storedetaildate = '2026-10-19 15:02:25' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '277', '274', '1', '2026-10-19 15:02:25','0','0'); -- id=4893
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '345', '12', '395', '1', '28', '28', '0', '', '0', '2026-10-19 15:02:25', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','28','28','0','','0','0.00','0','0','0','0'); -- id=2770
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 2770;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-19 15:02:25' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '1', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '29', '1', '2026-10-19 15:02:25','0','0'); -- id=4894
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','00608', '345', '6', '608', '5', '265', '1325', '0', '', '0', '2026-10-19 15:02:25', '608', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','265','1325','0','','0','0.00','0','0','0','0'); -- id=2771
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 2771;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (608, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-19 15:02:26' WHERE storedetailid = '608';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('608', '1', '5', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '0', '1', '2026-10-19 15:02:26','0','0'); -- id=4895
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '345', '14', '81', '5', '18.5', '92.5', '0', '', '0', '2026-10-19 15:02:26', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18.5','92.5','0','','0','0.00','0','0','0','0'); -- id=2772
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2772;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+92.5, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+92.5, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-19 15:02:26' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '51', '1', '2026-10-19 15:02:26','0','0'); -- id=4896
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 6;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35.89','00093', '345', '18', '93', '2', '36', '72', '0', '', '0', '2026-10-19 15:02:26', '93', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6-2,','1','1','0','0','36','72','0','','0','0.00','0','0','0','0'); -- id=2773
UPDATE sellbilldetail SET  lastbuyprice = 35.89 , meanbuyprice = 35.89, lastbuyprice_withDiscount = 35.89, meanbuyprice_withDiscount = 35.89
        , lastbuyprice_withTax = 35.89, meanbuyprice_withTax = 35.89, lastbuyprice_withDiscountAndTax = 35.89
                where sellbilldetailid = 2773;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (93, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-19 15:02:26' WHERE storedetailid = '93';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('93', '1', '2', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '50', '48', '1', '2026-10-19 15:02:26','0','0'); -- id=4897
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18.43','00094', '345', '18', '94', '2', '19', '38', '0', '', '0', '2026-10-19 15:02:26', '94', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=2774
UPDATE sellbilldetail SET  lastbuyprice = 18.43 , meanbuyprice = 18.43, lastbuyprice_withDiscount = 18.43, meanbuyprice_withDiscount = 18.43
        , lastbuyprice_withTax = 18.43, meanbuyprice_withTax = 18.43, lastbuyprice_withDiscountAndTax = 18.43
                where sellbilldetailid = 2774;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (94, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36.86
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36.86
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-19 15:02:27' WHERE storedetailid = '94';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('94', '1', '2', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '30', '1', '2026-10-19 15:02:27','0','0'); -- id=4898
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 4;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.73','00091', '345', '18', '91', '1', '9', '9', '0', '', '0', '2026-10-19 15:02:27', '91', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','4-1,','1','1','0','0','9','9','0','','0','0.00','0','0','0','0'); -- id=2775
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 2775;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (91, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.73
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.73
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '107', userid = '1', storedetaildate = '2026-10-19 15:02:27' WHERE storedetailid = '91';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('91', '1', '1', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '108', '107', '1', '2026-10-19 15:02:27','0','0'); -- id=4899
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('215','00223', '345', '13', '223', '1', '220', '220', '0', '', '0', '2026-10-19 15:02:27', '223', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','220','220','0','','0','0.00','0','0','0','0'); -- id=2776
UPDATE sellbilldetail SET  lastbuyprice = 215.00 , meanbuyprice = 215.00, lastbuyprice_withDiscount = 215.00, meanbuyprice_withDiscount = 215.00
        , lastbuyprice_withTax = 215, meanbuyprice_withTax = 215, lastbuyprice_withDiscountAndTax = 215
                where sellbilldetailid = 2776;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (223, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-19 15:02:27' WHERE storedetailid = '223';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '1', '1', '1', '345', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '4', '1', '2026-10-19 15:02:27','0','0'); -- id=4900
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-802571.9625',  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 ('-806378.5625','3806.6', '0', '1', 'اضافة فاتورة مبيعات', '345', '-802571.9625', '2026-10-19 15:02:27', '1',  'sellbillController.php','1','','0'); -- id=361
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3806.6', '3806.6', '2026-10-19', '1', '0', '0', '2026-10-19 15:02:28','اضافة فاتورة مبيعات رقم 345','1','0',null,'0','345','sellbillController.php?do=showDetail&sellbillid=345'); -- id=1778
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1778', '383', '3806.6', '','0'); -- id=1794
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '180892.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 ('1778', '143', '3806.6', '','0'); -- id=1782
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1526020.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3637.97', '3637.97', '2026-10-19', '1', '0', '0', '2026-10-19 15:02:28','اضافة فاتورة مبيعات رقم 345 - صرف البضاعة من المخزن','1','0',null,'0','345','sellbillController.php?do=showDetail&sellbillid=345'); -- id=1779
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1779', '402', '3637.97', '','0'); -- id=1795
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1362358.51', 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 ('1779', '382', '3637.97', '','0'); -- id=1783
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2185450.09', 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='1778,0,1779' where sellbillid=345;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 3806.6, 3637.97, 3637.97
                    , 3670.63, 3637.97, 3670.63, 3672.85
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3637.97, 3670.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3806.6, sellCostBuyPrice =sellCostBuyPrice+3637.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3637.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3670.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3637.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3670.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3672.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3637.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3670.63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 3806.6, 3637.97, 3637.97
                    , 3670.63, 3637.97, 3670.63, 3672.85
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3637.97, 3670.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3806.6, sellCostBuyPrice =sellCostBuyPrice+3637.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3637.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3670.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3637.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3670.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3672.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3637.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3670.63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3806.6, 3637.97, 3637.97
                    , 3670.63, 3637.97, 3670.63, 3672.85, 3637.97, 3670.63)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3806.6, netSellCostBuyPrice = netSellCostBuyPrice+3637.97
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3637.97
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3670.63
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3637.97
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3670.63
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3672.85
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3637.97
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3670.63;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad61127ad6e2 and sellbillId = 345 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:32:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:02:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:02:29', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4610
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:48:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:18:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:18:51', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4611
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:49:08";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:19:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:19:08', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4612
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:49:15";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:19:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:19:15', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=345'); -- id=4613
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:49:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:19:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:19:34', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4614
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 345;
UPDATE sellbill SET  sellbillsysdate = '2026-10-19 15:19:34', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '345';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 107;
UPDATE sellbilldetail SET  lastbuyprice = 999.00 , meanbuyprice = 1025.16, lastbuyprice_withDiscount = 999.00, meanbuyprice_withDiscount = 1025.16
        , lastbuyprice_withTax = 999, meanbuyprice_withTax = 1025.16, lastbuyprice_withDiscountAndTax = 999
                where sellbilldetailid = 2764;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (524, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1026, sellCostBuyPrice =sellCostBuyPrice-999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-999, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1025.16
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1026, sellCostBuyPrice =sellCostBuyPrice-999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-999, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1025.16
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-19 15:19:34' WHERE storedetailid = '524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('524', '1', '1', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '16', '1', '2026-10-19 15:02:22','0','0'); -- id=4901
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2765;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0,50,0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-312.5, sellCostBuyPrice =sellCostBuyPrice-295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-295, sellCostMeanBuyPrice = sellCostMeanBuyPrice-295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-295
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-50
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-312.5, sellCostBuyPrice =sellCostBuyPrice-295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-295, sellCostMeanBuyPrice = sellCostMeanBuyPrice-295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-295
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '441', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '50', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '391', '441', '1', '2026-10-19 15:02:22','0','0'); -- id=4902
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 = 2766;
 INSERT INTO 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-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-282.5, sellCostBuyPrice =sellCostBuyPrice-277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-277.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-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-282.5, sellCostBuyPrice =sellCostBuyPrice-277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-277.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 = '146', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '25', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '121', '146', '1', '2026-10-19 15:02:22','0','0'); -- id=4903
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 = 2767;
 INSERT INTO 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-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-79.1, sellCostBuyPrice =sellCostBuyPrice-77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77.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-7
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-79.1, sellCostBuyPrice =sellCostBuyPrice-77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77.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 = '94', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '7', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '87', '94', '1', '2026-10-19 15:02:22','0','0'); -- id=4904
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 48;
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2768;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-198, sellCostMeanBuyPrice = sellCostMeanBuyPrice-204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-204.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-198, sellCostMeanBuyPrice = sellCostMeanBuyPrice-204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-204.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '230', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '5', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '225', '230', '1', '2026-10-19 15:02:22','0','0'); -- id=4905
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2769;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-102, sellCostBuyPrice =sellCostBuyPrice-92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-92.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-102, sellCostBuyPrice =sellCostBuyPrice-92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-92.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '274', '277', '1', '2026-10-19 15:02:22','0','0'); -- id=4906
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 2770;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-28, sellCostBuyPrice =sellCostBuyPrice-26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-26, sellCostMeanBuyPrice = sellCostMeanBuyPrice-26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-28, sellCostBuyPrice =sellCostBuyPrice-26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-26, sellCostMeanBuyPrice = sellCostMeanBuyPrice-26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '1', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '29', '30', '1', '2026-10-19 15:02:22','0','0'); -- id=4907
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 2771;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (608, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1325, sellCostBuyPrice =sellCostBuyPrice-1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1250
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1325, sellCostBuyPrice =sellCostBuyPrice-1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1250
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '608';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('608', '1', '5', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '5', '1', '2026-10-19 15:02:22','0','0'); -- id=4908
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2772;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-92.5, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-90, sellCostMeanBuyPrice = sellCostMeanBuyPrice-90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-90
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-92.5, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-90, sellCostMeanBuyPrice = sellCostMeanBuyPrice-90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-90
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '56', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '51', '56', '1', '2026-10-19 15:02:22','0','0'); -- id=4909
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 6;
UPDATE sellbilldetail SET  lastbuyprice = 35.89 , meanbuyprice = 35.89, lastbuyprice_withDiscount = 35.89, meanbuyprice_withDiscount = 35.89
        , lastbuyprice_withTax = 35.89, meanbuyprice_withTax = 35.89, lastbuyprice_withDiscountAndTax = 35.89
                where sellbilldetailid = 2773;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (93, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-72, sellCostBuyPrice =sellCostBuyPrice-71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice-71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-71.78
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-72, sellCostBuyPrice =sellCostBuyPrice-71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice-71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-71.78
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '93';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('93', '1', '2', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '48', '50', '1', '2026-10-19 15:02:22','0','0'); -- id=4910
UPDATE sellbilldetail SET  lastbuyprice = 18.43 , meanbuyprice = 18.43, lastbuyprice_withDiscount = 18.43, meanbuyprice_withDiscount = 18.43
        , lastbuyprice_withTax = 18.43, meanbuyprice_withTax = 18.43, lastbuyprice_withDiscountAndTax = 18.43
                where sellbilldetailid = 2774;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (94, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36.86
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36.86
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-19 15:19:35' WHERE storedetailid = '94';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('94', '1', '2', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '32', '1', '2026-10-19 15:02:22','0','0'); -- id=4911
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 4;
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 2775;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (91, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9, sellCostBuyPrice =sellCostBuyPrice-8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8.73
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9, sellCostBuyPrice =sellCostBuyPrice-8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8.73
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '108', userid = '1', storedetaildate = '2026-10-19 15:19:36' WHERE storedetailid = '91';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('91', '1', '1', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '107', '108', '1', '2026-10-19 15:02:22','0','0'); -- id=4912
UPDATE sellbilldetail SET  lastbuyprice = 215.00 , meanbuyprice = 215.00, lastbuyprice_withDiscount = 215.00, meanbuyprice_withDiscount = 215.00
        , lastbuyprice_withTax = 215, meanbuyprice_withTax = 215, lastbuyprice_withDiscountAndTax = 215
                where sellbilldetailid = 2776;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (223, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-215, sellCostMeanBuyPrice = sellCostMeanBuyPrice-215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-215
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-215, sellCostMeanBuyPrice = sellCostMeanBuyPrice-215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-215
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-19 15:19:36' WHERE storedetailid = '223';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '1', '1', '0', '345', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '5', '1', '2026-10-19 15:02:22','0','0'); -- id=4913
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','تعديل فاتورة مبيعات','345', '0', '2026-10-19 15:02:22', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '3806.6', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 15:02:22','0','0','',''); -- id=587
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-806378.5375',  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 ('-802571.9375','3806.6', '1', '1', 'تعديل فاتورة مبيعات', '345', '-806378.5375', '2026-10-19 15:19:36', '1',  'sellbillController.php','1','','0'); -- id=362
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 3806.6, 3637.97, 3637.97
                    , 3670.63, 3637.97, 3670.63, 3672.85
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3637.97, 3670.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3806.6, sellCostBuyPrice =sellCostBuyPrice-3637.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3637.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3670.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3637.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3670.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3672.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3637.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3670.63
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 3806.6, 3637.97, 3637.97
                    , 3670.63, 3637.97, 3670.63, 3672.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3637.97, 3670.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3806.6, sellCostBuyPrice =sellCostBuyPrice-3637.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3637.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3670.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3637.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3670.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3672.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3637.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3670.63
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3806.6, 3637.97, 3637.97
                    , 3670.63, 3637.97, 3670.63, 3672.85, 3637.97, 3670.63)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-3806.6, netSellCostBuyPrice = netSellCostBuyPrice-3637.97
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-3637.97
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-3670.63
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-3637.97
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-3670.63
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-3672.85
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-3637.97
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-3670.63;

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


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 345 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-10-19 15:02:22', '06ad61127ad6e2', '1', '0.00', '0', '0', '1', '6266.6', '6266.6', '6266.6', '0', '1', '2026-10-19 15:02:22', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '111', '345', 'sellbillController', '0','','','','','-1','0','0','6266.6','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=346
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','اضافة فاتورة مبيعات (معدله)','346', '0', '2026-10-19 15:19:37', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '6266.6', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 15:02:22','0','0','',''); -- id=588
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 107;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1068.75','00524', '346', '6', '524', '1.00', '1026', '1026', '0', '', '0', '2026-10-19 15:19:37', '524', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','107-1,','1','1','0','0','1026','1026','0','','0','0.00','0','0','0','0'); -- id=2777
UPDATE sellbilldetail SET  lastbuyprice = 999.00 , meanbuyprice = 1025.16, lastbuyprice_withDiscount = 999.00, meanbuyprice_withDiscount = 1025.16
        , lastbuyprice_withTax = 999, meanbuyprice_withTax = 1025.16, lastbuyprice_withDiscountAndTax = 999
                where sellbilldetailid = 2777;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (524, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1026, sellCostBuyPrice =sellCostBuyPrice+999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+999, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1025.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1026, sellCostBuyPrice =sellCostBuyPrice+999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+999, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1025.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-19 15:19:37' WHERE storedetailid = '524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('524', '1', '1', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '16', '15', '1', '2026-10-19 15:19:37','0','0'); -- id=4914
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '346', '12', '86', '50.00', '6.25', '312.5', '0', '', '0', '2026-10-19 15:19:37', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','6.25','312.5','0','','0','0.00','0','0','0','0'); -- id=2778
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2778;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312.5, sellCostBuyPrice =sellCostBuyPrice+295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+295
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312.5, sellCostBuyPrice =sellCostBuyPrice+295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+295
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '391', userid = '1', storedetaildate = '2026-10-19 15:19:38' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '50', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '441', '391', '1', '2026-10-19 15:19:38','0','0'); -- id=4915
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '346', '12', '87', '25.00', '11.3', '282.5', '0', '', '0', '2026-10-19 15:19:38', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11.3','282.5','0','','0','0.00','0','0','0','0'); -- id=2779
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 = 2779;
 INSERT INTO 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-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+282.5, sellCostBuyPrice =sellCostBuyPrice+277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+277.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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+282.5, sellCostBuyPrice =sellCostBuyPrice+277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+277.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 = '121', userid = '1', storedetaildate = '2026-10-19 15:19:38' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '25', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '146', '121', '1', '2026-10-19 15:19:38','0','0'); -- id=4916
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '346', '12', '88', '7.00', '11.3', '79.10000000000001', '0', '', '0', '2026-10-19 15:19:38', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11.3','79.1','0','','0','0.00','0','0','0','0'); -- id=2780
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 = 2780;
 INSERT INTO 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-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79.1, sellCostBuyPrice =sellCostBuyPrice+77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.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+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79.1, sellCostBuyPrice =sellCostBuyPrice+77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.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 = '87', userid = '1', storedetaildate = '2026-10-19 15:19:38' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '7', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '94', '87', '1', '2026-10-19 15:19:38','0','0'); -- id=4917
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '346', '12', '83', '5.00', '44', '220', '0', '', '0', '2026-10-19 15:19:38', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','48-5,','1','1','0','0','44','220','0','','0','0.00','0','0','0','0'); -- id=2781
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2781;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '225', userid = '1', storedetaildate = '2026-10-19 15:19:39' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '5', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '230', '225', '1', '2026-10-19 15:19:39','0','0'); -- id=4918
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '346', '12', '82', '3.00', '34', '102', '0', '', '0', '2026-10-19 15:19:39', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-3,','1','1','0','0','34','102','0','','0','0.00','0','0','0','0'); -- id=2782
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2782;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '274', userid = '1', storedetaildate = '2026-10-19 15:19:39' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '277', '274', '1', '2026-10-19 15:19:39','0','0'); -- id=4919
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '346', '12', '395', '1.00', '28', '28', '0', '', '0', '2026-10-19 15:19:39', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','28','28','0','','0','0.00','0','0','0','0'); -- id=2783
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 2783;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-19 15:19:39' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '1', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '29', '1', '2026-10-19 15:19:39','0','0'); -- id=4920
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','00608', '346', '6', '608', '5.00', '265', '1325', '0', '', '0', '2026-10-19 15:19:39', '608', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','265','1325','0','','0','0.00','0','0','0','0'); -- id=2784
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 2784;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (608, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-19 15:19:40' WHERE storedetailid = '608';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('608', '1', '5', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '0', '1', '2026-10-19 15:19:40','0','0'); -- id=4921
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '346', '14', '81', '5.00', '18.5', '92.5', '0', '', '0', '2026-10-19 15:19:40', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18.5','92.5','0','','0','0.00','0','0','0','0'); -- id=2785
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2785;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+92.5, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+92.5, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-19 15:19:40' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '56', '51', '1', '2026-10-19 15:19:40','0','0'); -- id=4922
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 6;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35.89','00093', '346', '18', '93', '2.00', '36', '72', '0', '', '0', '2026-10-19 15:19:40', '93', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6-2,','1','1','0','0','36','72','0','','0','0.00','0','0','0','0'); -- id=2786
UPDATE sellbilldetail SET  lastbuyprice = 35.89 , meanbuyprice = 35.89, lastbuyprice_withDiscount = 35.89, meanbuyprice_withDiscount = 35.89
        , lastbuyprice_withTax = 35.89, meanbuyprice_withTax = 35.89, lastbuyprice_withDiscountAndTax = 35.89
                where sellbilldetailid = 2786;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (93, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-19 15:19:40' WHERE storedetailid = '93';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('93', '1', '2', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '50', '48', '1', '2026-10-19 15:19:40','0','0'); -- id=4923
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18.43','00094', '346', '18', '94', '2.00', '19', '38', '0', '', '0', '2026-10-19 15:19:40', '94', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=2787
UPDATE sellbilldetail SET  lastbuyprice = 18.43 , meanbuyprice = 18.43, lastbuyprice_withDiscount = 18.43, meanbuyprice_withDiscount = 18.43
        , lastbuyprice_withTax = 18.43, meanbuyprice_withTax = 18.43, lastbuyprice_withDiscountAndTax = 18.43
                where sellbilldetailid = 2787;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (94, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36.86
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36.86
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-19 15:19:41' WHERE storedetailid = '94';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('94', '1', '2', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '30', '1', '2026-10-19 15:19:41','0','0'); -- id=4924
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 4;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.73','00091', '346', '18', '91', '1.00', '9', '9', '0', '', '0', '2026-10-19 15:19:41', '91', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','4-1,','1','1','0','0','9','9','0','','0','0.00','0','0','0','0'); -- id=2788
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 2788;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (91, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.73
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.73
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '107', userid = '1', storedetaildate = '2026-10-19 15:19:41' WHERE storedetailid = '91';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('91', '1', '1', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '108', '107', '1', '2026-10-19 15:19:41','0','0'); -- id=4925
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('215','00223', '346', '13', '223', '1.00', '220', '220', '0', '', '0', '2026-10-19 15:19:41', '223', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','220','220','0','','0','0.00','0','0','0','0'); -- id=2789
UPDATE sellbilldetail SET  lastbuyprice = 215.00 , meanbuyprice = 215.00, lastbuyprice_withDiscount = 215.00, meanbuyprice_withDiscount = 215.00
        , lastbuyprice_withTax = 215, meanbuyprice_withTax = 215, lastbuyprice_withDiscountAndTax = 215
                where sellbilldetailid = 2789;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (223, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-19 15:19:41' WHERE storedetailid = '223';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '1', '1', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '4', '1', '2026-10-19 15:19:41','0','0'); -- id=4926
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('725','00258', '346', '10', '258', '3', '820', '2460', '0', '', '0', '2026-10-19 15:19:41', '258', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','820','2460','0','','0','0.00','0','0','0','0'); -- id=2790
UPDATE sellbilldetail SET  lastbuyprice = 725.00 , meanbuyprice = 725.00, lastbuyprice_withDiscount = 725.00, meanbuyprice_withDiscount = 725.00
        , lastbuyprice_withTax = 725, meanbuyprice_withTax = 725, lastbuyprice_withDiscountAndTax = 725
                where sellbilldetailid = 2790;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (258, '2026-10-19', 2460, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2460, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-19 15:19:42' WHERE storedetailid = '258';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '1', '3', '1', '346', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '12', '9', '1', '2026-10-19 15:19:42','0','0'); -- id=4927
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-800111.9625',  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 ('-806378.5625','6266.6', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '346', '-800111.9625', '2026-10-19 15:19:42', '1',  'sellbillController.php','1','','0'); -- id=363
UPDATE dailyentry SET totalcreditor = '3806.60', totaldebtor = '3806.60', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 15:02:28', entryComment = 'اضافة فاتورة مبيعات رقم 345', fromFlag = '1',related='0',isopeningentry='0',operationId='345',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=345' WHERE id = '1778';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3806.60', '3806.60', '2026-10-19', '1', '0', '1778', '2026-10-19 15:19:42','تم عكس القيد رقم 1778 ','1','0','0','0','0',''); -- id=1780
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1780', '383', '3806.60', '','0'); -- id=1784
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '177086.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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1780', '143', '3806.60', '','0'); -- id=1796
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1522214.3', 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 = '3637.97', totaldebtor = '3637.97', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 15:02:28', entryComment = 'اضافة فاتورة مبيعات رقم 345 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='345',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=345' WHERE id = '1779';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3637.97', '3637.97', '2026-10-19', '1', '0', '1779', '2026-10-19 15:19:43','تم عكس القيد رقم 1779 ','1','0','0','0','0',''); -- id=1781
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1781', '402', '3637.97', '','0'); -- id=1785
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1358720.54', 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 ('1781', '382', '3637.97', '','0'); -- id=1797
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2189088.06', 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 ( '6266.6', '6266.6', '2026-10-19', '1', '0', '0', '2026-10-19 15:19:43','اضافة فاتورة مبيعات رقم 346','1','0',null,'0','346','sellbillController.php?do=showDetail&sellbillid=346'); -- id=1782
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1782', '383', '6266.6', '','0'); -- id=1798
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '183352.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 ('1782', '143', '6266.6', '','0'); -- id=1786
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1528480.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5812.97', '5812.97', '2026-10-19', '1', '0', '0', '2026-10-19 15:19:43','اضافة فاتورة مبيعات رقم 346 - صرف البضاعة من المخزن','1','0',null,'0','346','sellbillController.php?do=showDetail&sellbillid=346'); -- id=1783
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1783', '402', '5812.97', '','0'); -- id=1799
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1364533.51', 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 ('1783', '382', '5812.97', '','0'); -- id=1787
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2183275.09', 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='1782,0,1783' where sellbillid=346;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 6266.6, 5812.97, 5812.97
                    , 5845.63, 5812.97, 5845.63, 5847.85
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5812.97, 5845.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6266.6, sellCostBuyPrice =sellCostBuyPrice+5812.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5812.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5845.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5812.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5845.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5847.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5812.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5845.63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 6266.6, 5812.97, 5812.97
                    , 5845.63, 5812.97, 5845.63, 5847.85
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5812.97, 5845.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6266.6, sellCostBuyPrice =sellCostBuyPrice+5812.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5812.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5845.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5812.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5845.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5847.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5812.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5845.63
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 6266.6, 5812.97, 5812.97
                    , 5845.63, 5812.97, 5845.63, 5847.85, 5812.97, 5845.63)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6266.6, netSellCostBuyPrice = netSellCostBuyPrice+5812.97
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5812.97
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5845.63
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5812.97
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5845.63
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5847.85
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5812.97
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5845.63;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 345 and newid=346 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:49:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:19:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:19:45', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=346'); -- id=4615
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:59:46";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:29:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:29:47', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4616
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:59:55";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:29:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:29:55', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4617
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 11:59:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:29:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:29:59', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=346'); -- id=4618
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:01:28";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:31:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:31:28', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4619
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 346;
UPDATE sellbill SET  sellbillsysdate = '2026-10-19 15:31:29', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '346';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 107;
UPDATE sellbilldetail SET  lastbuyprice = 999.00 , meanbuyprice = 1025.16, lastbuyprice_withDiscount = 999.00, meanbuyprice_withDiscount = 1025.16
        , lastbuyprice_withTax = 999, meanbuyprice_withTax = 1025.16, lastbuyprice_withDiscountAndTax = 999
                where sellbilldetailid = 2777;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (524, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1026, sellCostBuyPrice =sellCostBuyPrice-999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-999, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1025.16
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1026, sellCostBuyPrice =sellCostBuyPrice-999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-999, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1025.16
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-19 15:31:29' WHERE storedetailid = '524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('524', '1', '1', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '16', '1', '2026-10-19 15:02:22','0','0'); -- id=4928
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2778;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0,50,0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-312.5, sellCostBuyPrice =sellCostBuyPrice-295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-295, sellCostMeanBuyPrice = sellCostMeanBuyPrice-295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-295
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-50
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-312.5, sellCostBuyPrice =sellCostBuyPrice-295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-295, sellCostMeanBuyPrice = sellCostMeanBuyPrice-295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-295
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '441', userid = '1', storedetaildate = '2026-10-19 15:31:29' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '50', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '391', '441', '1', '2026-10-19 15:02:22','0','0'); -- id=4929
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 = 2779;
 INSERT INTO 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-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-282.5, sellCostBuyPrice =sellCostBuyPrice-277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-277.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-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-282.5, sellCostBuyPrice =sellCostBuyPrice-277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice-277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-277.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 = '146', userid = '1', storedetaildate = '2026-10-19 15:31:29' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '25', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '121', '146', '1', '2026-10-19 15:02:22','0','0'); -- id=4930
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 = 2780;
 INSERT INTO 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-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0,7,0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-79.1, sellCostBuyPrice =sellCostBuyPrice-77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77.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-7
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-79.1, sellCostBuyPrice =sellCostBuyPrice-77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice-77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-77.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 = '94', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '7', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '87', '94', '1', '2026-10-19 15:02:22','0','0'); -- id=4931
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 48;
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2781;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-198, sellCostMeanBuyPrice = sellCostMeanBuyPrice-204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-204.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-198, sellCostMeanBuyPrice = sellCostMeanBuyPrice-204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-204.5
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '230', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '5', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '225', '230', '1', '2026-10-19 15:02:22','0','0'); -- id=4932
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 47;
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2782;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-102, sellCostBuyPrice =sellCostBuyPrice-92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-92.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-102, sellCostBuyPrice =sellCostBuyPrice-92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice-92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-92.4
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '277', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '274', '277', '1', '2026-10-19 15:02:22','0','0'); -- id=4933
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 2783;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-28, sellCostBuyPrice =sellCostBuyPrice-26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-26, sellCostMeanBuyPrice = sellCostMeanBuyPrice-26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-28, sellCostBuyPrice =sellCostBuyPrice-26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-26, sellCostMeanBuyPrice = sellCostMeanBuyPrice-26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-26
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '1', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '29', '30', '1', '2026-10-19 15:02:22','0','0'); -- id=4934
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 2784;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (608, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1325, sellCostBuyPrice =sellCostBuyPrice-1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1250
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1325, sellCostBuyPrice =sellCostBuyPrice-1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1250
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '608';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('608', '1', '5', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '5', '1', '2026-10-19 15:02:22','0','0'); -- id=4935
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2785;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0,5,0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-92.5, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-90, sellCostMeanBuyPrice = sellCostMeanBuyPrice-90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-90
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-5
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-92.5, sellCostBuyPrice =sellCostBuyPrice-90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-90, sellCostMeanBuyPrice = sellCostMeanBuyPrice-90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-90
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '56', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '51', '56', '1', '2026-10-19 15:02:22','0','0'); -- id=4936
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-2 where id = 6;
UPDATE sellbilldetail SET  lastbuyprice = 35.89 , meanbuyprice = 35.89, lastbuyprice_withDiscount = 35.89, meanbuyprice_withDiscount = 35.89
        , lastbuyprice_withTax = 35.89, meanbuyprice_withTax = 35.89, lastbuyprice_withDiscountAndTax = 35.89
                where sellbilldetailid = 2786;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (93, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-72, sellCostBuyPrice =sellCostBuyPrice-71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice-71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-71.78
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-72, sellCostBuyPrice =sellCostBuyPrice-71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice-71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-71.78
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '93';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('93', '1', '2', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '48', '50', '1', '2026-10-19 15:02:22','0','0'); -- id=4937
UPDATE sellbilldetail SET  lastbuyprice = 18.43 , meanbuyprice = 18.43, lastbuyprice_withDiscount = 18.43, meanbuyprice_withDiscount = 18.43
        , lastbuyprice_withTax = 18.43, meanbuyprice_withTax = 18.43, lastbuyprice_withDiscountAndTax = 18.43
                where sellbilldetailid = 2787;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (94, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0,2,0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36.86
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-2
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-38, sellCostBuyPrice =sellCostBuyPrice-36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice-36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-36.86
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '94';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('94', '1', '2', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '32', '1', '2026-10-19 15:02:22','0','0'); -- id=4938
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-1 where id = 4;
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 2788;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (91, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9, sellCostBuyPrice =sellCostBuyPrice-8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8.73
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9, sellCostBuyPrice =sellCostBuyPrice-8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8.73
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '108', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '91';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('91', '1', '1', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '107', '108', '1', '2026-10-19 15:02:22','0','0'); -- id=4939
UPDATE sellbilldetail SET  lastbuyprice = 215.00 , meanbuyprice = 215.00, lastbuyprice_withDiscount = 215.00, meanbuyprice_withDiscount = 215.00
        , lastbuyprice_withTax = 215, meanbuyprice_withTax = 215, lastbuyprice_withDiscountAndTax = 215
                where sellbilldetailid = 2789;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (223, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0,1,0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-215, sellCostMeanBuyPrice = sellCostMeanBuyPrice-215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-215
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-1
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-220, sellCostBuyPrice =sellCostBuyPrice-215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-215, sellCostMeanBuyPrice = sellCostMeanBuyPrice-215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-215
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-19 15:31:30' WHERE storedetailid = '223';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '1', '1', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '4', '5', '1', '2026-10-19 15:02:22','0','0'); -- id=4940
UPDATE sellbilldetail SET  lastbuyprice = 725.00 , meanbuyprice = 725.00, lastbuyprice_withDiscount = 725.00, meanbuyprice_withDiscount = 725.00
        , lastbuyprice_withTax = 725, meanbuyprice_withTax = 725, lastbuyprice_withDiscountAndTax = 725
                where sellbilldetailid = 2790;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (258, '2026-10-19', 2460, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2460, sellCostBuyPrice =sellCostBuyPrice-2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2175
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2460, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2460, sellCostBuyPrice =sellCostBuyPrice-2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2175
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '12', userid = '1', storedetaildate = '2026-10-19 15:31:31' WHERE storedetailid = '258';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '1', '3', '0', '346', 'تعديل فاتورة مبيعات', 'sellbillController.php', '9', '12', '1', '2026-10-19 15:02:22','0','0'); -- id=4941
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','تعديل فاتورة مبيعات','346', '0', '2026-10-19 15:02:22', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '6266.6', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 15:02:22','0','0','',''); -- id=589
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-806378.5375',  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 ('-800111.9375','6266.6', '1', '1', 'تعديل فاتورة مبيعات', '346', '-806378.5375', '2026-10-19 15:31:31', '1',  'sellbillController.php','1','','0'); -- id=364
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 6266.6, 5812.97, 5812.97
                    , 5845.63, 5812.97, 5845.63, 5847.85
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5812.97, 5845.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6266.6, sellCostBuyPrice =sellCostBuyPrice-5812.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5812.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5845.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5812.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5845.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5847.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5812.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5845.63
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 6266.6, 5812.97, 5812.97
                    , 5845.63, 5812.97, 5845.63, 5847.85
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5812.97, 5845.63, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6266.6, sellCostBuyPrice =sellCostBuyPrice-5812.97
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-5812.97, sellCostMeanBuyPrice = sellCostMeanBuyPrice-5845.63
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-5812.97, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-5845.63
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-5847.85
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-5812.97
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-5845.63
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 6266.6, 5812.97, 5812.97
                    , 5845.63, 5812.97, 5845.63, 5847.85, 5812.97, 5845.63)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-6266.6, netSellCostBuyPrice = netSellCostBuyPrice-5812.97
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-5812.97
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-5845.63
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-5812.97
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-5845.63
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-5847.85
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-5812.97
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-5845.63;

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


-- ----------------------------------------------------------------------------------------------------
-- bill update start - new add start - with id = 346 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-10-19 15:02:22', '06ad61127ad6e2', '1', '0.00', '0', '0', '1', '6665.6', '6665.6', '6665.6', '0', '1', '2026-10-19 15:02:22', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '116', '346', 'sellbillController', '0','','','','','-1','0','0','6665.6','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=347
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','اضافة فاتورة مبيعات (معدله)','347', '0', '2026-10-19 15:31:32', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '6665.6', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 15:02:22','0','0','',''); -- id=590
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 107;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('1068.75','00524', '347', '6', '524', '1.00', '1026', '1026', '0', '', '0', '2026-10-19 15:31:32', '524', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','107-1,','1','1','0','0','1026','1026','0','','0','0.00','0','0','0','0'); -- id=2791
UPDATE sellbilldetail SET  lastbuyprice = 999.00 , meanbuyprice = 1025.16, lastbuyprice_withDiscount = 999.00, meanbuyprice_withDiscount = 1025.16
        , lastbuyprice_withTax = 999, meanbuyprice_withTax = 1025.16, lastbuyprice_withDiscountAndTax = 999
                where sellbilldetailid = 2791;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (524, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1026, sellCostBuyPrice =sellCostBuyPrice+999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+999, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1025.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1026, 999, 999
                    , 1025.16, 999, 1025.16, 1033.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 999, 1025.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1026, sellCostBuyPrice =sellCostBuyPrice+999
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+999, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1025.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1025.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1033.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+999
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1025.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-19 15:31:32' WHERE storedetailid = '524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('524', '1', '1', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '16', '15', '1', '2026-10-19 15:31:32','0','0'); -- id=4942
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('5.9','00086', '347', '12', '86', '50.00', '6.25', '312.5', '0', '', '0', '2026-10-19 15:31:32', '86', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','6.25','312.5','0','','0','0.00','0','0','0','0'); -- id=2792
UPDATE sellbilldetail SET  lastbuyprice = 5.90 , meanbuyprice = 5.90, lastbuyprice_withDiscount = 5.90, meanbuyprice_withDiscount = 5.90
        , lastbuyprice_withTax = 5.9, meanbuyprice_withTax = 5.9, lastbuyprice_withDiscountAndTax = 5.9
                where sellbilldetailid = 2792;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (86, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312.5, sellCostBuyPrice =sellCostBuyPrice+295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+295
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 312.5, 295, 295
                    , 295, 295, 295, 295
                    , 0, 0, 0, 0
                    , 0, 0, 0, 295, 295, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+312.5, sellCostBuyPrice =sellCostBuyPrice+295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+295
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+295
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+295
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+295
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '391', userid = '1', storedetaildate = '2026-10-19 15:31:32' WHERE storedetailid = '86';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('86', '1', '50', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '441', '391', '1', '2026-10-19 15:31:32','0','0'); -- id=4943
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '347', '12', '87', '25.00', '11.3', '282.5', '0', '', '0', '2026-10-19 15:31:33', '87', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11.3','282.5','0','','0','0.00','0','0','0','0'); -- id=2793
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 = 2793;
 INSERT INTO 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-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+282.5, sellCostBuyPrice =sellCostBuyPrice+277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+277.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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 282.5, 277.5, 277.5
                    , 277.5, 277.5, 277.5, 277.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 277.5, 277.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+282.5, sellCostBuyPrice =sellCostBuyPrice+277.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+277.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+277.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+277.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+277.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+277.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+277.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+277.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 = '121', userid = '1', storedetaildate = '2026-10-19 15:31:33' WHERE storedetailid = '87';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('87', '1', '25', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '146', '121', '1', '2026-10-19 15:31:33','0','0'); -- id=4944
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '347', '12', '88', '7.00', '11.3', '79.10000000000001', '0', '', '0', '2026-10-19 15:31:33', '88', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','11.3','79.1','0','','0','0.00','0','0','0','0'); -- id=2794
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 = 2794;
 INSERT INTO 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-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79.1, sellCostBuyPrice =sellCostBuyPrice+77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.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+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 79.1, 77.7, 77.7
                    , 77.7, 77.7, 77.7, 77.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 77.7, 77.7, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+79.1, sellCostBuyPrice =sellCostBuyPrice+77.7
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.7, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.7
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.7
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.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 = '87', userid = '1', storedetaildate = '2026-10-19 15:31:33' WHERE storedetailid = '88';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('88', '1', '7', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '94', '87', '1', '2026-10-19 15:31:33','0','0'); -- id=4945
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 48;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('39.6','00083', '347', '12', '83', '5.00', '44', '220', '0', '', '0', '2026-10-19 15:31:33', '83', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','48-5,','1','1','0','0','44','220','0','','0','0.00','0','0','0','0'); -- id=2795
UPDATE sellbilldetail SET  lastbuyprice = 39.60 , meanbuyprice = 40.90, lastbuyprice_withDiscount = 39.60, meanbuyprice_withDiscount = 40.90
        , lastbuyprice_withTax = 39.6, meanbuyprice_withTax = 40.9, lastbuyprice_withDiscountAndTax = 39.6
                where sellbilldetailid = 2795;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (83, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 198, 198
                    , 204.5, 198, 204.5, 198
                    , 0, 0, 0, 0
                    , 0, 0, 0, 198, 204.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+204.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+198, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+204.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+198
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+204.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '225', userid = '1', storedetaildate = '2026-10-19 15:31:34' WHERE storedetailid = '83';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('83', '1', '5', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '230', '225', '1', '2026-10-19 15:31:34','0','0'); -- id=4946
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 47;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('30.8','00082', '347', '12', '82', '3.00', '34', '102', '0', '', '0', '2026-10-19 15:31:34', '82', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','47-3,','1','1','0','0','34','102','0','','0','0.00','0','0','0','0'); -- id=2796
UPDATE sellbilldetail SET  lastbuyprice = 30.80 , meanbuyprice = 30.80, lastbuyprice_withDiscount = 30.80, meanbuyprice_withDiscount = 30.80
        , lastbuyprice_withTax = 30.8, meanbuyprice_withTax = 30.8, lastbuyprice_withDiscountAndTax = 30.8
                where sellbilldetailid = 2796;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (82, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 102, 92.4, 92.4
                    , 92.4, 92.4, 92.4, 92.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 92.4, 92.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+102, sellCostBuyPrice =sellCostBuyPrice+92.4
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+92.4, sellCostMeanBuyPrice = sellCostMeanBuyPrice+92.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+92.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+92.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+92.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+92.4
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+92.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '274', userid = '1', storedetaildate = '2026-10-19 15:31:34' WHERE storedetailid = '82';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('82', '1', '3', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '277', '274', '1', '2026-10-19 15:31:34','0','0'); -- id=4947
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('26','00395', '347', '12', '395', '1.00', '28', '28', '0', '', '0', '2026-10-19 15:31:34', '395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','28','28','0','','0','0.00','0','0','0','0'); -- id=2797
UPDATE sellbilldetail SET  lastbuyprice = 26.00 , meanbuyprice = 26.00, lastbuyprice_withDiscount = 26.00, meanbuyprice_withDiscount = 26.00
        , lastbuyprice_withTax = 26, meanbuyprice_withTax = 26, lastbuyprice_withDiscountAndTax = 26
                where sellbilldetailid = 2797;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (395, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 28, 26, 26
                    , 26, 26, 26, 26
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26, 26, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+28, sellCostBuyPrice =sellCostBuyPrice+26
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '29', userid = '1', storedetaildate = '2026-10-19 15:31:34' WHERE storedetailid = '395';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('395', '1', '1', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '30', '29', '1', '2026-10-19 15:31:34','0','0'); -- id=4948
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','00608', '347', '6', '608', '5.00', '265', '1325', '0', '', '0', '2026-10-19 15:31:34', '608', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','265','1325','0','','0','0.00','0','0','0','0'); -- id=2798
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 2798;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (608, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1325, 1250, 1250
                    , 1250, 1250, 1250, 1250
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1250, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1325, sellCostBuyPrice =sellCostBuyPrice+1250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-19 15:31:35' WHERE storedetailid = '608';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('608', '1', '5', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '0', '1', '2026-10-19 15:31:35','0','0'); -- id=4949
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '347', '14', '81', '5.00', '18.5', '92.5', '0', '', '0', '2026-10-19 15:31:35', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','18.5','92.5','0','','0','0.00','0','0','0','0'); -- id=2799
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2799;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+92.5, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 92.5, 90, 90
                    , 90, 90, 90, 90
                    , 0, 0, 0, 0
                    , 0, 0, 0, 90, 90, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+92.5, sellCostBuyPrice =sellCostBuyPrice+90
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+90, sellCostMeanBuyPrice = sellCostMeanBuyPrice+90
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+90, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+90
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+90
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+90
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+90
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-19 15:31:35' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '5', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '56', '51', '1', '2026-10-19 15:31:35','0','0'); -- id=4950
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 6;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('35.89','00093', '347', '18', '93', '2.00', '36', '72', '0', '', '0', '2026-10-19 15:31:35', '93', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6-2,','1','1','0','0','36','72','0','','0','0.00','0','0','0','0'); -- id=2800
UPDATE sellbilldetail SET  lastbuyprice = 35.89 , meanbuyprice = 35.89, lastbuyprice_withDiscount = 35.89, meanbuyprice_withDiscount = 35.89
        , lastbuyprice_withTax = 35.89, meanbuyprice_withTax = 35.89, lastbuyprice_withDiscountAndTax = 35.89
                where sellbilldetailid = 2800;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (93, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 72, 71.78, 71.78
                    , 71.78, 71.78, 71.78, 71.78
                    , 0, 0, 0, 0
                    , 0, 0, 0, 71.78, 71.78, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+72, sellCostBuyPrice =sellCostBuyPrice+71.78
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+71.78, sellCostMeanBuyPrice = sellCostMeanBuyPrice+71.78
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+71.78, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+71.78
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+71.78
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+71.78
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+71.78
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '1', storedetaildate = '2026-10-19 15:31:35' WHERE storedetailid = '93';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('93', '1', '2', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '50', '48', '1', '2026-10-19 15:31:35','0','0'); -- id=4951
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18.43','00094', '347', '18', '94', '2.00', '19', '38', '0', '', '0', '2026-10-19 15:31:35', '94', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','19','38','0','','0','0.00','0','0','0','0'); -- id=2801
UPDATE sellbilldetail SET  lastbuyprice = 18.43 , meanbuyprice = 18.43, lastbuyprice_withDiscount = 18.43, meanbuyprice_withDiscount = 18.43
        , lastbuyprice_withTax = 18.43, meanbuyprice_withTax = 18.43, lastbuyprice_withDiscountAndTax = 18.43
                where sellbilldetailid = 2801;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (94, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36.86
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 38, 36.86, 36.86
                    , 36.86, 36.86, 36.86, 36.86
                    , 0, 0, 0, 0
                    , 0, 0, 0, 36.86, 36.86, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+38, sellCostBuyPrice =sellCostBuyPrice+36.86
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+36.86, sellCostMeanBuyPrice = sellCostMeanBuyPrice+36.86
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+36.86, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+36.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+36.86
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+36.86
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+36.86
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-19 15:31:36' WHERE storedetailid = '94';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('94', '1', '2', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '32', '30', '1', '2026-10-19 15:31:36','0','0'); -- id=4952
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 4;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('8.73','00091', '347', '18', '91', '1.00', '9', '9', '0', '', '0', '2026-10-19 15:31:36', '91', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','4-1,','1','1','0','0','9','9','0','','0','0.00','0','0','0','0'); -- id=2802
UPDATE sellbilldetail SET  lastbuyprice = 8.73 , meanbuyprice = 8.73, lastbuyprice_withDiscount = 8.73, meanbuyprice_withDiscount = 8.73
        , lastbuyprice_withTax = 8.73, meanbuyprice_withTax = 8.73, lastbuyprice_withDiscountAndTax = 8.73
                where sellbilldetailid = 2802;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (91, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.73
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 9, 8.73, 8.73
                    , 8.73, 8.73, 8.73, 8.73
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8.73, 8.73, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9, sellCostBuyPrice =sellCostBuyPrice+8.73
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8.73, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8.73
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8.73, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8.73
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8.73
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8.73
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '107', userid = '1', storedetaildate = '2026-10-19 15:31:36' WHERE storedetailid = '91';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('91', '1', '1', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '108', '107', '1', '2026-10-19 15:31:36','0','0'); -- id=4953
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('215','00223', '347', '13', '223', '1.00', '220', '220', '0', '', '0', '2026-10-19 15:31:36', '223', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','220','220','0','','0','0.00','0','0','0','0'); -- id=2803
UPDATE sellbilldetail SET  lastbuyprice = 215.00 , meanbuyprice = 215.00, lastbuyprice_withDiscount = 215.00, meanbuyprice_withDiscount = 215.00
        , lastbuyprice_withTax = 215, meanbuyprice_withTax = 215, lastbuyprice_withDiscountAndTax = 215
                where sellbilldetailid = 2803;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (223, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 220, 215, 215
                    , 215, 215, 215, 215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 215, 215, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+220, sellCostBuyPrice =sellCostBuyPrice+215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+215, sellCostMeanBuyPrice = sellCostMeanBuyPrice+215
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+215
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+215
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-19 15:31:36' WHERE storedetailid = '223';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('223', '1', '1', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '4', '1', '2026-10-19 15:31:36','0','0'); -- id=4954
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('725','00258', '347', '10', '258', '3.00', '820', '2460', '0', '', '0', '2026-10-19 15:31:37', '258', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','820','2460','0','','0','0.00','0','0','0','0'); -- id=2804
UPDATE sellbilldetail SET  lastbuyprice = 725.00 , meanbuyprice = 725.00, lastbuyprice_withDiscount = 725.00, meanbuyprice_withDiscount = 725.00
        , lastbuyprice_withTax = 725, meanbuyprice_withTax = 725, lastbuyprice_withDiscountAndTax = 725
                where sellbilldetailid = 2804;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (258, '2026-10-19', 2460, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 2460, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-19 15:31:37' WHERE storedetailid = '258';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('258', '1', '3', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '12', '9', '1', '2026-10-19 15:31:37','0','0'); -- id=4955
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('232','00114', '347', '3', '114', '1', '235', '235', '0', '', '0', '2026-10-19 15:31:37', '114', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','235','235','0','','0','0.00','0','0','0','0'); -- id=2805
UPDATE sellbilldetail SET  lastbuyprice = 232.00 , meanbuyprice = 232.00, lastbuyprice_withDiscount = 232.00, meanbuyprice_withDiscount = 232.00
        , lastbuyprice_withTax = 232, meanbuyprice_withTax = 232, lastbuyprice_withDiscountAndTax = 232
                where sellbilldetailid = 2805;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (114, '2026-10-19', 235, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+235, sellCostBuyPrice =sellCostBuyPrice+232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+232, sellCostMeanBuyPrice = sellCostMeanBuyPrice+232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+232
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 235, 232, 232
                    , 232, 232, 232, 232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 232, 232, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+235, sellCostBuyPrice =sellCostBuyPrice+232
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+232, sellCostMeanBuyPrice = sellCostMeanBuyPrice+232
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+232
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+232
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '1', storedetaildate = '2026-10-19 15:31:37' WHERE storedetailid = '114';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('114', '1', '1', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '5', '4', '1', '2026-10-19 15:31:37','0','0'); -- id=4956
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('32.95','00181', '347', '20', '181', '2', '34', '68', '0', '', '0', '2026-10-19 15:31:37', '181', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','34','68','0','','0','0.00','0','0','0','0'); -- id=2806
UPDATE sellbilldetail SET  lastbuyprice = 32.95 , meanbuyprice = 32.95, lastbuyprice_withDiscount = 32.95, meanbuyprice_withDiscount = 32.95
        , lastbuyprice_withTax = 32.95, meanbuyprice_withTax = 32.95, lastbuyprice_withDiscountAndTax = 32.95
                where sellbilldetailid = 2806;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (181, '2026-10-19', 68, 65.9, 65.9
                    , 65.9, 65.9, 65.9, 65.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 65.9, 65.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+68, sellCostBuyPrice =sellCostBuyPrice+65.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 68, 65.9, 65.9
                    , 65.9, 65.9, 65.9, 65.9
                    , 0, 0, 0, 0
                    , 0, 0, 0, 65.9, 65.9, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+68, sellCostBuyPrice =sellCostBuyPrice+65.9
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+65.9, sellCostMeanBuyPrice = sellCostMeanBuyPrice+65.9
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+65.9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+65.9
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+65.9
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+65.9
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+65.9
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2026-10-19 15:31:37' WHERE storedetailid = '181';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('181', '1', '2', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '12', '10', '1', '2026-10-19 15:31:38','0','0'); -- id=4957
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '347', '20', '182', '2', '48', '96', '0', '', '0', '2026-10-19 15:31:38', '182', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','48','96','0','','0','0.00','0','0','0','0'); -- id=2807
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 = 2807;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (182, '2026-10-19', 96, 85.44, 85.44
                    , 85.44, 85.44, 85.44, 85.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0, 85.44, 85.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+96, sellCostBuyPrice =sellCostBuyPrice+85.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+85.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+85.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+85.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+85.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+85.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+85.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+85.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+2
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 96, 85.44, 85.44
                    , 85.44, 85.44, 85.44, 85.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 85.44, 85.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+96, sellCostBuyPrice =sellCostBuyPrice+85.44
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+85.44, sellCostMeanBuyPrice = sellCostMeanBuyPrice+85.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+85.44, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+85.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+85.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+85.44
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+85.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '829', userid = '1', storedetaildate = '2026-10-19 15:31:38' WHERE storedetailid = '182';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('182', '1', '2', '1', '347', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '831', '829', '1', '2026-10-19 15:31:38','0','0'); -- id=4958
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-799712.9625',  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 ('-806378.5625','6665.6', '0', '1', 'اضافة فاتورة مبيعات (معدله)', '347', '-799712.9625', '2026-10-19 15:31:38', '1',  'sellbillController.php','1','','0'); -- id=365
UPDATE dailyentry SET totalcreditor = '6266.60', totaldebtor = '6266.60', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 15:19:43', entryComment = 'اضافة فاتورة مبيعات رقم 346', fromFlag = '1',related='0',isopeningentry='0',operationId='346',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=346' WHERE id = '1782';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6266.60', '6266.60', '2026-10-19', '1', '0', '1782', '2026-10-19 15:31:38','تم عكس القيد رقم 1782 ','1','0','0','0','0',''); -- id=1784
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1784', '383', '6266.60', '','0'); -- id=1788
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '177086.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 dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1784', '143', '6266.60', '','0'); -- id=1800
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1522214.3', 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 = '5812.97', totaldebtor = '5812.97', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 15:19:43', entryComment = 'اضافة فاتورة مبيعات رقم 346 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='346',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=346' WHERE id = '1783';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5812.97', '5812.97', '2026-10-19', '1', '0', '1783', '2026-10-19 15:31:39','تم عكس القيد رقم 1783 ','1','0','0','0','0',''); -- id=1785
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1785', '402', '5812.97', '','0'); -- id=1789
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1358720.54', 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 ('1785', '382', '5812.97', '','0'); -- id=1801
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2189088.06', 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 ( '6665.6', '6665.6', '2026-10-19', '1', '0', '0', '2026-10-19 15:31:39','اضافة فاتورة مبيعات رقم 347','1','0',null,'0','347','sellbillController.php?do=showDetail&sellbillid=347'); -- id=1786
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1786', '383', '6665.6', '','0'); -- id=1802
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '183751.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 ('1786', '143', '6665.6', '','0'); -- id=1790
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1528879.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6196.31', '6196.31', '2026-10-19', '1', '0', '0', '2026-10-19 15:31:39','اضافة فاتورة مبيعات رقم 347 - صرف البضاعة من المخزن','1','0',null,'0','347','sellbillController.php?do=showDetail&sellbillid=347'); -- id=1787
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1787', '402', '6196.31', '','0'); -- id=1803
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1364916.85', 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 ('1787', '382', '6196.31', '','0'); -- id=1791
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2182891.75', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1786,0,1787' where sellbillid=347;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 6665.6, 6196.31, 6196.31
                    , 6228.97, 6196.31, 6228.97, 6231.19
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6196.31, 6228.97, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6665.6, sellCostBuyPrice =sellCostBuyPrice+6196.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6196.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6228.97
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6196.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6228.97
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6231.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6196.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6228.97
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 6665.6, 6196.31, 6196.31
                    , 6228.97, 6196.31, 6228.97, 6231.19
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6196.31, 6228.97, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6665.6, sellCostBuyPrice =sellCostBuyPrice+6196.31
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6196.31, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6228.97
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6196.31, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6228.97
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6231.19
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6196.31
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6228.97
                        , returnSellVal = returnSellVal+0, 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, 6665.6, 6196.31, 6196.31
                    , 6228.97, 6196.31, 6228.97, 6231.19, 6196.31, 6228.97)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6665.6, netSellCostBuyPrice = netSellCostBuyPrice+6196.31
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6196.31
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6228.97
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6196.31
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6228.97
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6231.19
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6196.31
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6228.97;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 346 and newid=347 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:01:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:31:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:31:41', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=347'); -- id=4620
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:15:54";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:45:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:45:54', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4621
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:17:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:47:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-19 15:47:45', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php'); -- id=4622
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:18:05";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:48:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-19 15:48:05', '1', 'autosave', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/inventoryController.php?do=autosave'); -- id=4623
UPDATE storedetail SET  productquantity = '85', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '194';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('194', '1', '50', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '35', '85', '1', '2026-10-19','0','0'); -- id=4959
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '775', '775', '2026-10-19', '1', '0', '0', '2026-10-19 15:48:05','اعادة جرد للمنتج : (شاسيه اسبوط اسود مربع /باندا) فى مخزن : (المخزن الرئيسي) بالكمية : 85','1','0',null,'0','4959','inventoryController.php?do=details&id=4959'); -- id=1788
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1788', '382', '775', '','0'); -- id=1804
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2183666.75', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1788', '188', '775', '','0'); -- id=1792
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-69337.9', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:18:07";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 15:48:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 15:48:07', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4624
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:32:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 16:02:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 16:02:40', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4625

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad61f129c7ea
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 16:02:41', '06ad61f129c7ea', '1', '0.00', '0', '0', '1', '3921.00', '3921', '3921', '0', '1', '2026-10-19 16:02:41', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '118' ,'0','','','','','-1','0','0','0','0','0','3921','0','','0','0','3921','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=348
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','اضافة فاتورة مبيعات','348', '0', '2026-10-19 16:02:41', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3921', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-19 16:02:41','0','0','',''); -- id=591
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+57 where id = 211;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('22','00604', '348', '20', '604', '57', '33', '1881', '0', '', '1', '2026-10-19 16:02:41', '604', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','211-57,','1','1','0','0','33','1881','0','','0','0.00','0','0','0','0'); -- id=2808
UPDATE sellbilldetail SET  lastbuyprice = 22.00 , meanbuyprice = 22.00, lastbuyprice_withDiscount = 22.00, meanbuyprice_withDiscount = 22.00
        , lastbuyprice_withTax = 22, meanbuyprice_withTax = 22, lastbuyprice_withDiscountAndTax = 22
                where sellbilldetailid = 2808;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (604, '2026-10-19', 1881, 1254, 1254
                    , 1254, 1254, 1254, 1254
                    , 0, 0, 0, 0
                    , 0, 0, 0, 57, 0, 1254, 1254, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1881, sellCostBuyPrice =sellCostBuyPrice+1254
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1254, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1254
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1254, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1254
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1254
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1254
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1254
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+57
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 1881, 1254, 1254
                    , 1254, 1254, 1254, 1254
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1254, 1254, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1881, sellCostBuyPrice =sellCostBuyPrice+1254
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1254, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1254
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1254, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1254
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1254
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1254
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1254
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '228', userid = '1', storedetaildate = '2026-10-19 16:02:42' WHERE storedetailid = '604';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('604', '1', '57', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '285', '228', '1', '2026-10-19 16:02:42','0','0'); -- id=4960
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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.5','00194', '348', '20', '194', '50', '16', '800', '0', '', '1', '2026-10-19 16:02:42', '194', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','16','800','0','','0','0.00','0','0','0','0'); -- id=2809
UPDATE sellbilldetail SET  lastbuyprice = 15.50 , meanbuyprice = 15.50, lastbuyprice_withDiscount = 15.50, meanbuyprice_withDiscount = 15.50
        , lastbuyprice_withTax = 15.5, meanbuyprice_withTax = 15.5, lastbuyprice_withDiscountAndTax = 15.5
                where sellbilldetailid = 2809;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (194, '2026-10-19', 800, 775, 775
                    , 775, 775, 775, 775
                    , 0, 0, 0, 0
                    , 0, 0, 0, 50, 0, 775, 775, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+775
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+775, sellCostMeanBuyPrice = sellCostMeanBuyPrice+775
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+775, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+775
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+775
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+775
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+775
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+50
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 800, 775, 775
                    , 775, 775, 775, 775
                    , 0, 0, 0, 0
                    , 0, 0, 0, 775, 775, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+800, sellCostBuyPrice =sellCostBuyPrice+775
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+775, sellCostMeanBuyPrice = sellCostMeanBuyPrice+775
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+775, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+775
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+775
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+775
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+775
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2026-10-19 16:02:42' WHERE storedetailid = '194';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('194', '1', '50', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '85', '35', '1', '2026-10-19 16:02:42','0','0'); -- id=4961
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 143;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('735','00209', '348', '10', '209', '1', '760', '760', '0', '', '1', '2026-10-19 16:02:42', '209', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','143-1,','1','1','0','0','760','760','0','','0','0.00','0','0','0','0'); -- id=2810
UPDATE sellbilldetail SET  lastbuyprice = 735.00 , meanbuyprice = 735.00, lastbuyprice_withDiscount = 735.00, meanbuyprice_withDiscount = 735.00
        , lastbuyprice_withTax = 735, meanbuyprice_withTax = 735, lastbuyprice_withDiscountAndTax = 735
                where sellbilldetailid = 2810;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (209, '2026-10-19', 760, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 760, 735, 735
                    , 735, 735, 735, 735
                    , 0, 0, 0, 0
                    , 0, 0, 0, 735, 735, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+760, sellCostBuyPrice =sellCostBuyPrice+735
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+735, sellCostMeanBuyPrice = sellCostMeanBuyPrice+735
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+735, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+735
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+735
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+735
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+735
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '1', storedetaildate = '2026-10-19 16:02:42' WHERE storedetailid = '209';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('209', '1', '1', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '5', '1', '2026-10-19 16:02:42','0','0'); -- id=4962
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 164;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('45','00567', '348', '9', '567', '10', '48', '480', '0', '', '1', '2026-10-19 16:02:42', '567', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','164-10,','1','1','0','0','48','480','0','','0','0.00','0','0','0','0'); -- id=2811
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 2811;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (567, '2026-10-19', 480, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 480, 450, 450
                    , 450, 450, 450, 450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 450, 450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+480, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '77', userid = '1', storedetaildate = '2026-10-19 16:02:42' WHERE storedetailid = '567';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('567', '1', '10', '1', '348', 'اضافة فاتورة مبيعات', 'sellbillController.php', '87', '77', '1', '2026-10-19 16:02:42','0','0'); -- id=4963
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '-795791.9375',  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 ('-799712.9375','3921', '0', '1', 'اضافة فاتورة مبيعات', '348', '-795791.9375', '2026-10-19 16:02:43', '1',  'sellbillController.php','1','','0'); -- id=366
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3921', '3921', '2026-10-19', '1', '0', '0', '2026-10-19 16:02:43','اضافة فاتورة مبيعات رقم 348','1','0',null,'0','348','sellbillController.php?do=showDetail&sellbillid=348'); -- id=1789
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1789', '383', '3921', '','0'); -- id=1805
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '187672.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 ('1789', '143', '3921', '','0'); -- id=1793
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1532800.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3214', '3214', '2026-10-19', '1', '0', '0', '2026-10-19 16:02:43','اضافة فاتورة مبيعات رقم 348 - صرف البضاعة من المخزن','1','0',null,'0','348','sellbillController.php?do=showDetail&sellbillid=348'); -- id=1790
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1790', '402', '3214', '','0'); -- id=1806
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1368130.85', 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 ('1790', '382', '3214', '','0'); -- id=1794
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2180452.75', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1789,0,1790' where sellbillid=348;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 3921, 3214, 3214
                    , 3214, 3214, 3214, 3214
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3214, 3214, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3921, sellCostBuyPrice =sellCostBuyPrice+3214
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3214, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3214
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3214, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3214
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3214
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3214
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3214
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 3921, 3214, 3214
                    , 3214, 3214, 3214, 3214
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3214, 3214, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3921, sellCostBuyPrice =sellCostBuyPrice+3214
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3214, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3214
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3214, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3214
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3214
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3214
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3214
                        , returnSellVal = returnSellVal+0, 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, 3921, 3214, 3214
                    , 3214, 3214, 3214, 3214, 3214, 3214)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3921, netSellCostBuyPrice = netSellCostBuyPrice+3214
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3214
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3214
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3214
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3214
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3214
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3214
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3214;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad61f129c7ea and sellbillId = 348 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 12:32:44";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 16:02:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 16:02:44', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4626
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:47:00";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:17:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 17:17:00', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4627
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:47:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:17:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 17:17:11', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4628
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:47:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:17:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 17:17:17', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=342'); -- id=4629
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:47:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:17:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 17:17:38', '1', 'update', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=update'); -- id=4630
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 342;
UPDATE sellbill SET  sellbillsysdate = '2026-10-19 17:17:39', userid = '1',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '342';
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2727;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0,10,0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-10
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-190, sellCostBuyPrice =sellCostBuyPrice-180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-180, sellCostMeanBuyPrice = sellCostMeanBuyPrice-180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-180
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '61', userid = '1', storedetaildate = '2026-10-19 17:17:39' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '0', '342', 'تعديل فاتورة مبيعات', 'sellbillController.php', '51', '61', '1', '2026-10-19 09:53:42','0','0'); -- id=4964
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2728;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-120, sellCostBuyPrice =sellCostBuyPrice-88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-88, sellCostMeanBuyPrice = sellCostMeanBuyPrice-88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-88
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '58', userid = '1', storedetaildate = '2026-10-19 17:17:39' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '0', '342', 'تعديل فاتورة مبيعات', 'sellbillController.php', '50', '58', '1', '2026-10-19 09:53:42','0','0'); -- id=4965
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-25 where id = 200;
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 2729;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '394', userid = '1', storedetaildate = '2026-10-19 17:17:39' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '0', '342', 'تعديل فاتورة مبيعات', 'sellbillController.php', '369', '394', '1', '2026-10-19 09:53:42','0','0'); -- id=4966
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 = 2730;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0,25,0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-25
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-443.75, sellCostBuyPrice =sellCostBuyPrice-440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-440, sellCostMeanBuyPrice = sellCostMeanBuyPrice-440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-440
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '271', userid = '1', storedetaildate = '2026-10-19 17:17:39' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '0', '342', 'تعديل فاتورة مبيعات', 'sellbillController.php', '246', '271', '1', '2026-10-19 09:53:42','0','0'); -- id=4967
UPDATE sellbilldetail SET  lastbuyprice = 13.50 , meanbuyprice = 13.50, lastbuyprice_withDiscount = 13.50, meanbuyprice_withDiscount = 13.50
        , lastbuyprice_withTax = 13.5, meanbuyprice_withTax = 13.5, lastbuyprice_withDiscountAndTax = 13.5
                where sellbilldetailid = 2731;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (606, '2026-10-19', 128, 108, 108
                    , 108, 108, 108, 108
                    , 0, 0, 0, 0
                    , 0, 0, 0,8,0, 108, 108, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-108
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-108, sellCostMeanBuyPrice = sellCostMeanBuyPrice-108
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-108, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-108
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-108
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-108
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-108
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-8
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 128, 108, 108
                    , 108, 108, 108, 108
                    , 0, 0, 0, 0
                    , 0, 0, 0, 108, 108, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-128, sellCostBuyPrice =sellCostBuyPrice-108
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-108, sellCostMeanBuyPrice = sellCostMeanBuyPrice-108
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-108, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-108
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-108
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-108
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-108
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-19 17:17:39' WHERE storedetailid = '606';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('606', '1', '8', '0', '342', 'تعديل فاتورة مبيعات', 'sellbillController.php', '19', '27', '1', '2026-10-19 09:53:42','0','0'); -- id=4968
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '1986', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','3311.50','1325.50','1','تعديل فاتورة مبيعات','342', '1986', '2026-10-19 09:53:42', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '1325.5', '0', null, '0', null, null,'', '0','1','1','1325.5','1','2026-10-19 09:53:42','0','0','',''); -- id=592
UPDATE client SET  inUse = 0 where clientid = 46;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 1325.5, 1256, 1256
                    , 1256, 1256, 1256, 1256
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1256, 1256, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1325.5, sellCostBuyPrice =sellCostBuyPrice-1256
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1256, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1256
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1256, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1256
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1256
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1256
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1256
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-19', 1325.5, 1256, 1256
                    , 1256, 1256, 1256, 1256
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1256, 1256, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-1325.5, sellCostBuyPrice =sellCostBuyPrice-1256
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-1256, sellCostMeanBuyPrice = sellCostMeanBuyPrice-1256
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1256, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1256
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1256
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-1256
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-1256
                        , returnSellVal = returnSellVal-0, 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, 1325.5, 1256, 1256
                    , 1256, 1256, 1256, 1256, 1256, 1256)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-1325.5, netSellCostBuyPrice = netSellCostBuyPrice-1256
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-1256
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-1256
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-1256
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-1256
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-1256
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-1256
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-1256;

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


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

COMMIT;
BEGIN;
CALL clientInUse(46,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 09:53:42', '06ad5cc6d650ca', '46', '1986.00', '3353.5', '0', '1', '1367.5', '1367.5', '0', '1367.5', '1', '2026-10-19 09:53:42', '', '1', '0', 'الحاج رفعت الجندي', '1', '1', '3', '0', 'الحاج رفعت الجندي', '73', '342', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=349
UPDATE client SET  clientdebt = '3353.5', userid = '1' WHERE clientid = '46';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('46','1986.00','1367.5','0','اضافة فاتورة مبيعات (معدله)','349', '3353.5', '2026-10-19 17:17:40', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '1367.5', '0', null, '0', null, null,'', '0','1','1','1325.5','1','2026-10-19 09:53:42','0','0','',''); -- id=593
UPDATE client SET  inUse = 0 where clientid = 46;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('18','00081', '349', '14', '81', '10.00', '19', '190', '0', '', '1', '2026-10-19 17:17:41', '81', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','19','190','0','','0','0.00','0','0','0','0'); -- id=2812
UPDATE sellbilldetail SET  lastbuyprice = 18.00 , meanbuyprice = 18.00, lastbuyprice_withDiscount = 18.00, meanbuyprice_withDiscount = 18.00
        , lastbuyprice_withTax = 18, meanbuyprice_withTax = 18, lastbuyprice_withDiscountAndTax = 18
                where sellbilldetailid = 2812;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (81, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 190, 180, 180
                    , 180, 180, 180, 180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 180, 180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-19 17:17:41' WHERE storedetailid = '81';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('81', '1', '10', '1', '349', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '61', '51', '1', '2026-10-19 17:17:41','0','0'); -- id=4969
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('11','00207', '349', '6', '207', '8.00', '15', '120', '0', '', '1', '2026-10-19 17:17:41', '207', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','120','0','','0','0.00','0','0','0','0'); -- id=2813
UPDATE sellbilldetail SET  lastbuyprice = 11.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 11.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 11
                where sellbilldetailid = 2813;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (207, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 120, 88, 88
                    , 88, 88, 88, 88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 88, 88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+88
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+88, sellCostMeanBuyPrice = sellCostMeanBuyPrice+88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+88, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+88
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-19 17:17:41' WHERE storedetailid = '207';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('207', '1', '8', '1', '349', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '58', '50', '1', '2026-10-19 17:17:41','0','0'); -- id=4970
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '349', '3', '100', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-19 17:17:41', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','200-25,','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2814
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 2814;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '369', userid = '1', storedetaildate = '2026-10-19 17:17:42' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '25', '1', '349', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '394', '369', '1', '2026-10-19 17:17:42','0','0'); -- id=4971
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '349', '3', '101', '25.00', '17.75', '443.75', '0', '', '1', '2026-10-19 17:17:42', '101', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','17.75','443.75','0','','0','0.00','0','0','0','0'); -- id=2815
UPDATE sellbilldetail SET  lastbuyprice = 17.60 , meanbuyprice = 17.60, lastbuyprice_withDiscount = 17.60, meanbuyprice_withDiscount = 17.60
        , lastbuyprice_withTax = 17.6, meanbuyprice_withTax = 17.6, lastbuyprice_withDiscountAndTax = 17.6
                where sellbilldetailid = 2815;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (101, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 443.75, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+443.75, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '246', userid = '1', storedetaildate = '2026-10-19 17:17:42' WHERE storedetailid = '101';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('101', '1', '25', '1', '349', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '271', '246', '1', '2026-10-19 17:17:42','0','0'); -- id=4972
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('31.86','00123', '349', '15', '123', '5', '34', '170', '0', '', '1', '2026-10-19 17:17:42', '123', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','34','170','0','','0','0.00','0','0','0','0'); -- id=2816
UPDATE sellbilldetail SET  lastbuyprice = 31.86 , meanbuyprice = 31.86, lastbuyprice_withDiscount = 31.86, meanbuyprice_withDiscount = 31.86
        , lastbuyprice_withTax = 31.86, meanbuyprice_withTax = 31.86, lastbuyprice_withDiscountAndTax = 31.86
                where sellbilldetailid = 2816;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (123, '2026-10-19', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 170, 159.3, 159.3
                    , 159.3, 159.3, 159.3, 159.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 159.3, 159.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+159.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+159.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+159.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+159.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+159.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+159.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+159.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+159.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '1', storedetaildate = '2026-10-19 17:17:42' WHERE storedetailid = '123';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('123', '1', '5', '1', '349', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '83', '78', '1', '2026-10-19 17:17:42','0','0'); -- id=4973
UPDATE dailyentry SET totalcreditor = '1325.50', totaldebtor = '1325.50', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 14:18:21', entryComment = 'اضافة فاتورة مبيعات رقم 342', fromFlag = '1',related='0',isopeningentry='0',operationId='342',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=342' WHERE id = '1769';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1325.50', '1325.50', '2026-10-19', '1', '0', '1769', '2026-10-19 17:17:42','تم عكس القيد رقم 1769 ','1','0','0','0','0',''); -- id=1791
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1791', '479', '1325.50', '','0'); -- id=1795
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '1986', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1791', '143', '1325.50', '','0'); -- id=1807
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1531475.4', 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 = '1256.00', totaldebtor = '1256.00', thedate = '2026-10-19', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-19 14:18:21', entryComment = 'اضافة فاتورة مبيعات رقم 342 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='342',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=342' WHERE id = '1770';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1256.00', '1256.00', '2026-10-19', '1', '0', '1770', '2026-10-19 17:17:43','تم عكس القيد رقم 1770 ','1','0','0','0','0',''); -- id=1792
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1792', '402', '1256.00', '','0'); -- id=1796
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1366874.85', 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 ('1792', '382', '1256.00', '','0'); -- id=1808
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2181708.75', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1367.5', '1367.5', '2026-10-19', '1', '0', '0', '2026-10-19 17:17:43','اضافة فاتورة مبيعات رقم 349','1','0',null,'0','349','sellbillController.php?do=showDetail&sellbillid=349'); -- id=1793
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1793', '479', '1367.5', '','0'); -- id=1809
UPDATE accountstree SET name = 'الحاج رفعت الجندي', customName = 'الحاج رفعت الجندي', customNameEn = 'الحاج رفعت الجندي', nameEn = 'الحاج رفعت الجندي', parent = '58', accountNature = '0', theValue = '3353.5', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-04 21:28:33' WHERE id = '479';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1793', '143', '1367.5', '','0'); -- id=1797
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1532842.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1307.3', '1307.3', '2026-10-19', '1', '0', '0', '2026-10-19 17:17:43','اضافة فاتورة مبيعات رقم 349 - صرف البضاعة من المخزن','1','0',null,'0','349','sellbillController.php?do=showDetail&sellbillid=349'); -- id=1794
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1794', '402', '1307.3', '','0'); -- id=1810
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1368182.15', 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 ('1794', '382', '1307.3', '','0'); -- id=1798
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2180401.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1793,0,1794' where sellbillid=349;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 1367.5, 1307.3, 1307.3
                    , 1307.3, 1307.3, 1307.3, 1307.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1307.3, 1307.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1367.5, sellCostBuyPrice =sellCostBuyPrice+1307.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1307.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1307.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1307.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1307.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1307.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1307.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1307.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (46, '2026-10-19', 1367.5, 1307.3, 1307.3
                    , 1307.3, 1307.3, 1307.3, 1307.3
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1307.3, 1307.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1367.5, sellCostBuyPrice =sellCostBuyPrice+1307.3
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1307.3, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1307.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1307.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1307.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1307.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1307.3
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1307.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 1367.5, 1307.3, 1307.3
                    , 1307.3, 1307.3, 1307.3, 1307.3, 1307.3, 1307.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+1367.5, netSellCostBuyPrice = netSellCostBuyPrice+1307.3
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1307.3
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1307.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1307.3
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1307.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1307.3
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1307.3
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1307.3;
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:47:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:17:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 17:17:45', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editprint&id=349'); -- id=4631
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:48:02";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:18:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-19 17:18:02', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php'); -- id=4632
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:48:11";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:18:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2026-10-19 17:18:12', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/profitreportController.php?do=show'); -- id=4633
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 13:48:19";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:18:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 17:18:20', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4634
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:16:13";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:46:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 17:46:13', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php'); -- id=4635
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:16:32";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:46:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 17:46:32', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=add'); -- id=4636

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =594
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(49,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '2255' , clientdate = '2026-10-19 17:46:33', userid = '1' WHERE clientid = '49';
UPDATE client SET  inUse = 0 where clientid = 49;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('49','7255.00','5000','1','ايصال تحصيل (( قبض من عميل ))','594', '2255', '2026-10-19 17:46:14', '1', 'clientPayedDeptController.php', '   ', '5000', '0', null, '0', null, null,'', '-1','1','1','5000','1','','62','0','','.'); -- id=594
UPDATE save SET  savecurrentvalue = '-790791.94',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-795791.94','5000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '594', '-790791.94', '2026-10-19 17:46:33', '1',  'clientPayedDeptController.php','49','','0'); -- id=367
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5000', '5000', '2026-10-19', '1', '0', '0', '2026-10-19 17:46:33','اضافة ايصال سداد للعميل السيد الالفي ','1','0','0','0','594','clientPayedDeptController.php?do=show&id=594'); -- id=1795
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1795', '383', '5000', '','0'); -- id=1811
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '192672.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 ('1795', '482', '5000', '','0'); -- id=1799
UPDATE accountstree SET name = 'السيد الالفي ', customName = 'السيد الالفي ', customNameEn = 'السيد الالفي ', nameEn = 'السيد الالفي ', parent = '58', accountNature = '0', theValue = '2255', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-11 20:54:17' WHERE id = '482';
UPDATE clientdebtchange SET clientid = '49', clientdebtchangebefore = '7255.000', clientdebtchangeamount = '5000.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '594', clientdebtchangeafter = '2255.000', clientdebtchangedate = '2026-10-19 17:46:14', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '5000.000',discount='', reciptid='0', dailyentryid = '1795',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='5000',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '594';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:16:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:46:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 17:46:34', '1', 'sucess', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=4637
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:16:36";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:46:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-19 17:46:36', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientPayedDeptController.php?do=show'); -- id=4638
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:17:29";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:47:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 17:47:29', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4639
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:17:49";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:47:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 17:47:49', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=show'); -- id=4640
UPDATE productunit SET proUnitSellAllPrice  = 460 * productnumber  WHERE productid = 71;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو اصفر', productDescription = '', productCatId = '12', productBuyPrice = '312.00', productSellAllPrice = '460', productSellUnitPrice = '380.00', productSellHalfPrice = '380.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '5', parcode = '00071',type ='0', expireDate = '0' , dailyentryId = '83',isService = '0',isOptic = '0',lastbuyprice = '312.00',lastbuyprice_withDiscount = '312',meanbuyprice = '312.00',meanbuyprice_withDiscount = '312' , 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='312',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='312',meanbuyprice_withTax='312',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='312',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '71';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (71, 1,'2026-10-19 17:48:07',1)
                ON DUPLICATE KEY UPDATE productid = 71, edited = 1, sysdate = '2026-10-19 17:48:07', userid = 1; -- id=75
UPDATE productunit SET proUnitSellHalfPrice = 460 * productnumber WHERE productid = 71;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو اصفر', productDescription = '', productCatId = '12', productBuyPrice = '312.00', productSellAllPrice = '460.00', productSellUnitPrice = '380.00', productSellHalfPrice = '460', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '5', parcode = '00071',type ='0', expireDate = '0' , dailyentryId = '83',isService = '0',isOptic = '0',lastbuyprice = '312.00',lastbuyprice_withDiscount = '312',meanbuyprice = '312.00',meanbuyprice_withDiscount = '312' , 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='312',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='312',meanbuyprice_withTax='312',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='312',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '71';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (71, 1,'2026-10-19 17:48:08',1)
                ON DUPLICATE KEY UPDATE productid = 71, edited = 1, sysdate = '2026-10-19 17:48:08', userid = 1; -- id=75
UPDATE productunit SET proUnitSellUnitPrice = 460 * productnumber WHERE productid = 71;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو اصفر', productDescription = '', productCatId = '12', productBuyPrice = '312.00', productSellAllPrice = '460.00', productSellUnitPrice = '460', productSellHalfPrice = '460.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '5', parcode = '00071',type ='0', expireDate = '0' , dailyentryId = '83',isService = '0',isOptic = '0',lastbuyprice = '312.00',lastbuyprice_withDiscount = '312',meanbuyprice = '312.00',meanbuyprice_withDiscount = '312' , 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='312',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='312',meanbuyprice_withTax='312',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='312',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '71';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (71, 1,'2026-10-19 17:48:10',1)
                ON DUPLICATE KEY UPDATE productid = 71, edited = 1, sysdate = '2026-10-19 17:48:10', userid = 1; -- id=75
UPDATE productunit SET proUnitSellAllPrice  = 380.00 * productnumber  WHERE productid = 72;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو اخضر', productDescription = '', productCatId = '12', productBuyPrice = '312.00', productSellAllPrice = '380.00', productSellUnitPrice = '380.00', productSellHalfPrice = '380.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00072',type ='0', expireDate = '0' , dailyentryId = '84',isService = '0',isOptic = '0',lastbuyprice = '312.00',lastbuyprice_withDiscount = '312',meanbuyprice = '312.00',meanbuyprice_withDiscount = '312' , productbuypricereal = '312.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '952.88',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='312',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='312',meanbuyprice_withTax='312',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='312',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '72';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (72, 1,'2026-10-19 17:48:11',1)
                ON DUPLICATE KEY UPDATE productid = 72, edited = 1, sysdate = '2026-10-19 17:48:11', userid = 1; -- id=76
UPDATE productunit SET proUnitSellHalfPrice = 460 * productnumber WHERE productid = 72;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو اخضر', productDescription = '', productCatId = '12', productBuyPrice = '312.00', productSellAllPrice = '380.00', productSellUnitPrice = '380.00', productSellHalfPrice = '460', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00072',type ='0', expireDate = '0' , dailyentryId = '84',isService = '0',isOptic = '0',lastbuyprice = '312.00',lastbuyprice_withDiscount = '312',meanbuyprice = '312.00',meanbuyprice_withDiscount = '312' , productbuypricereal = '312.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '952.88',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='312',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='312',meanbuyprice_withTax='312',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='312',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '72';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (72, 1,'2026-10-19 17:48:12',1)
                ON DUPLICATE KEY UPDATE productid = 72, edited = 1, sysdate = '2026-10-19 17:48:12', userid = 1; -- id=76
UPDATE productunit SET proUnitSellUnitPrice = 460 * productnumber WHERE productid = 72;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو اخضر', productDescription = '', productCatId = '12', productBuyPrice = '312.00', productSellAllPrice = '380.00', productSellUnitPrice = '460', productSellHalfPrice = '460.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00072',type ='0', expireDate = '0' , dailyentryId = '84',isService = '0',isOptic = '0',lastbuyprice = '312.00',lastbuyprice_withDiscount = '312',meanbuyprice = '312.00',meanbuyprice_withDiscount = '312' , productbuypricereal = '312.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '952.88',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='312',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='312',meanbuyprice_withTax='312',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='312',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '72';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (72, 1,'2026-10-19 17:48:14',1)
                ON DUPLICATE KEY UPDATE productid = 72, edited = 1, sysdate = '2026-10-19 17:48:14', userid = 1; -- id=76
UPDATE productunit SET proUnitSellAllPrice  = 460 * productnumber  WHERE productid = 72;
UPDATE product SET productName = 'لفه خرطوم 16 ملي مصطفي محمود 4 كيلو اخضر', productDescription = '', productCatId = '12', productBuyPrice = '312.00', productSellAllPrice = '460', productSellUnitPrice = '460.00', productSellHalfPrice = '460.00', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00072',type ='0', expireDate = '0' , dailyentryId = '84',isService = '0',isOptic = '0',lastbuyprice = '312.00',lastbuyprice_withDiscount = '312',meanbuyprice = '312.00',meanbuyprice_withDiscount = '312' , productbuypricereal = '312.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.56' , buyhalf_precentage = '2.56' , buypart_precentage = '952.88',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='312',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='312',meanbuyprice_withTax='312',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='312',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '72';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (72, 1,'2026-10-19 17:48:21',1)
                ON DUPLICATE KEY UPDATE productid = 72, edited = 1, sysdate = '2026-10-19 17:48:21', userid = 1; -- id=76
UPDATE productunit SET proUnitSellAllPrice  = 575 * productnumber  WHERE productid = 73;
UPDATE product SET productName = 'لفه خرطوم 23 ملي مصطفي محمود 5 كيلو', productDescription = '', productCatId = '12', productBuyPrice = '435.00', productSellAllPrice = '575', 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.00',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='423.46',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';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (73, 1,'2026-10-19 17:48:23',1)
                ON DUPLICATE KEY UPDATE productid = 73, edited = 1, sysdate = '2026-10-19 17:48:23', userid = 1; -- id=77
UPDATE productunit SET proUnitSellHalfPrice = 575 * productnumber WHERE productid = 73;
UPDATE product SET productName = 'لفه خرطوم 23 ملي مصطفي محمود 5 كيلو', productDescription = '', productCatId = '12', productBuyPrice = '435.00', productSellAllPrice = '575.00', productSellUnitPrice = '475.00', productSellHalfPrice = '575', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '5', parcode = '00073',type ='0', expireDate = '0' , dailyentryId = '85',isService = '0',isOptic = '0',lastbuyprice = '435.00',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='423.46',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';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (73, 1,'2026-10-19 17:48:24',1)
                ON DUPLICATE KEY UPDATE productid = 73, edited = 1, sysdate = '2026-10-19 17:48:24', userid = 1; -- id=77
UPDATE productunit SET proUnitSellUnitPrice = 575 * productnumber WHERE productid = 73;
UPDATE product SET productName = 'لفه خرطوم 23 ملي مصطفي محمود 5 كيلو', productDescription = '', productCatId = '12', productBuyPrice = '435.00', productSellAllPrice = '575.00', productSellUnitPrice = '575', productSellHalfPrice = '575.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.00',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='423.46',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';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (73, 1,'2026-10-19 17:48:35',1)
                ON DUPLICATE KEY UPDATE productid = 73, edited = 1, sysdate = '2026-10-19 17:48:35', userid = 1; -- id=77
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:18:42";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 17:48:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 17:48:43', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4641
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:49:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:19:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 18:19:53', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4642
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:50:18";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:20:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 18:20:18', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4643
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('بلبله دش','','6','2','3.5','3.5','3.5','2026-10-19','0','1','0','','0','0','0','0','0','2','2','2','2','2','0','75','75','75','.','0','0','0','2','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','2','2','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','2','0','0','0','0','0','0','','','0','0','0','0'); -- id=609
UPDATE product SET productName = 'بلبله دش', productDescription = '', productCatId = '6', productBuyPrice = '2', productSellAllPrice = '3.5', productSellUnitPrice = '3.5', productSellHalfPrice = '3.5', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00609',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '2',lastbuyprice_withDiscount = '2',meanbuyprice = '2',meanbuyprice_withDiscount = '2' , productbuypricereal = '2' , buypricereal_precentage = '0' , buytotal_precentage = '75' , buyhalf_precentage = '75' , buypart_precentage = '75',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='2',meanbuyprice_withTax='2',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='2',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '609';
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', '609', '1.00', '2026-10-19', '1', '0','0060901','3.5','3.5','3.5','2','','0','0','0','0','0','0','0','0','0','0'); -- id=609
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('609', '1', '150', '1', '2026-10-19'); -- id=609
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('609', '1', '150', '0', '609', 'إضافة منتج', 'productController.php', '0', '150', '1', '2026-10-19','0','0'); -- id=4974
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (609, 1,'2026-10-19 18:20:19',1)
                ON DUPLICATE KEY UPDATE productid = 609, edited = 1, sysdate = '2026-10-19 18:20:19', userid = 1; -- id=821
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '300', '300', '2026-10-19', '1', '0', '0', '2026-10-19 18:20:19','إضافة منتج بلبله دش الكمية 150','1','0','0','0','609','productController.php?do=edit&id=609'); -- id=1796
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1796', '382', '300', '','0'); -- id=1812
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2180701.45', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1796', '121', '300', '','0'); -- id=1800
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1851789.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'بلبله دش', productDescription = '', productCatId = '6', productBuyPrice = '2.00', productSellAllPrice = '3.50', productSellUnitPrice = '3.50', productSellHalfPrice = '3.50', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00609',type ='0', expireDate = '0' , dailyentryId = '1796',isService = '0',isOptic = '0',lastbuyprice = '2',lastbuyprice_withDiscount = '2',meanbuyprice = '2',meanbuyprice_withDiscount = '2' , productbuypricereal = '2' , buypricereal_precentage = '0' , buytotal_precentage = '75' , buyhalf_precentage = '75' , buypart_precentage = '75',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='2',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='2',meanbuyprice_withTax='2',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='2',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '609';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:50:22";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:20:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 18:20:22', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4644
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:50:34";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:20:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 18:20:34', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4645

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad63bdbbecff
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(40,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 18:20:34', '06ad63bdbbecff', '40', '241.40', '327.4', '0', '1', '86.00', '86', '0', '86', '1', '2026-10-19 18:20:34', '', '1', '0', 'صابر علي ', '1', '1', '3', '0', 'صابر علي ', '6' ,'0','','','','','-1','0','0','0','0','0','86','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=350
UPDATE client SET  clientdebt = '327.4', userid = '1' WHERE clientid = '40';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('40','241.40','86','0','اضافة فاتورة مبيعات','350', '327.4', '2026-10-19 18:20:35', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '86', '0', null, '0', null, null,'', '0','1','1','86','1','2026-10-19 18:20:34','0','0','',''); -- id=595
UPDATE client SET  inUse = 0 where clientid = 40;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 153;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00003', '350', '1', '3', '1', '36', '36', '0', '', '1', '2026-10-19 18:20:35', '3', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','153-1,','1','1','0','0','36','36','0','','0','0.00','0','0','0','0'); -- id=2817
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 2817;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (3, '2026-10-19', 36, 34.8, 34.8
                    , 34.8, 34.8, 34.8, 34.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 34.8, 34.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+34.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 36, 34.8, 34.8
                    , 34.8, 34.8, 34.8, 34.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 34.8, 34.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+34.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2569', userid = '1', storedetaildate = '2026-10-19 18:20:35' WHERE storedetailid = '3';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('3', '1', '1', '1', '350', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2570', '2569', '1', '2026-10-19 18:20:35','0','0'); -- id=4975
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 154;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('34.8','00004', '350', '1', '4', '1', '36', '36', '0', '', '1', '2026-10-19 18:20:35', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','154-1,','1','1','0','0','36','36','0','','0','0.00','0','0','0','0'); -- id=2818
UPDATE sellbilldetail SET  lastbuyprice = 34.80 , meanbuyprice = 34.80, lastbuyprice_withDiscount = 34.80, meanbuyprice_withDiscount = 34.80
        , lastbuyprice_withTax = 34.8, meanbuyprice_withTax = 34.8, lastbuyprice_withDiscountAndTax = 34.8
                where sellbilldetailid = 2818;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2026-10-19', 36, 34.8, 34.8
                    , 34.8, 34.8, 34.8, 34.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 34.8, 34.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+34.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 36, 34.8, 34.8
                    , 34.8, 34.8, 34.8, 34.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 34.8, 34.8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+36, sellCostBuyPrice =sellCostBuyPrice+34.8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+34.8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+34.8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+34.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+34.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+34.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+34.8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+34.8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '2718', userid = '1', storedetaildate = '2026-10-19 18:20:36' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '350', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2719', '2718', '1', '2026-10-19 18:20:36','0','0'); -- id=4976
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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','00609', '350', '6', '609', '4', '3.5', '14', '0', '', '1', '2026-10-19 18:20:36', '609', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','3.5','14','0','','0','0.00','0','0','0','0'); -- id=2819
UPDATE sellbilldetail SET  lastbuyprice = 2.00 , meanbuyprice = 2.00, lastbuyprice_withDiscount = 2.00, meanbuyprice_withDiscount = 2.00
        , lastbuyprice_withTax = 2, meanbuyprice_withTax = 2, lastbuyprice_withDiscountAndTax = 2
                where sellbilldetailid = 2819;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (609, '2026-10-19', 14, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 14, 8, 8
                    , 8, 8, 8, 8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 8, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14, sellCostBuyPrice =sellCostBuyPrice+8
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '146', userid = '1', storedetaildate = '2026-10-19 18:20:36' WHERE storedetailid = '609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('609', '1', '4', '1', '350', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '146', '1', '2026-10-19 18:20:36','0','0'); -- id=4977
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '86', '86', '2026-10-19', '1', '0', '0', '2026-10-19 18:20:36','اضافة فاتورة مبيعات رقم 350','1','0',null,'0','350','sellbillController.php?do=showDetail&sellbillid=350'); -- id=1797
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1797', '472', '86', '','0'); -- id=1813
UPDATE accountstree SET name = 'صابر علي ', customName = 'صابر علي ', customNameEn = 'صابر علي ', nameEn = 'صابر علي ', parent = '58', accountNature = '0', theValue = '327.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-28 13:54:46' WHERE id = '472';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1797', '143', '86', '','0'); -- id=1801
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1532928.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '77.6', '77.6', '2026-10-19', '1', '0', '0', '2026-10-19 18:20:36','اضافة فاتورة مبيعات رقم 350 - صرف البضاعة من المخزن','1','0',null,'0','350','sellbillController.php?do=showDetail&sellbillid=350'); -- id=1798
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1798', '402', '77.6', '','0'); -- id=1814
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1368259.75', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1798', '382', '77.6', '','0'); -- id=1802
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2180623.85', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='1797,0,1798' where sellbillid=350;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 86, 77.6, 77.6
                    , 77.6, 77.6, 77.6, 77.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,77.6, 77.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+86, sellCostBuyPrice =sellCostBuyPrice+77.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (40, '2026-10-19', 86, 77.6, 77.6
                    , 77.6, 77.6, 77.6, 77.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,77.6, 77.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+86, sellCostBuyPrice =sellCostBuyPrice+77.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+77.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+77.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+77.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+77.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+77.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+77.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+77.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 86, 77.6, 77.6
                    , 77.6, 77.6, 77.6, 77.6, 77.6, 77.6)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+86, netSellCostBuyPrice = netSellCostBuyPrice+77.6
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+77.6
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+77.6
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+77.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+77.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+77.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+77.6
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+77.6;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad63bdbbecff and sellbillId = 350 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 14:50:38";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:20:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 18:20:38', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4646
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 15:02:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:32:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-19 18:32:41', '1', 'bill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=4647
UPDATE productunit SET unitid = '1', productid = '212', productnumber = '1.00', productunitdate = '2026-09-15', userid = '1', conditions = '0',proUnitParcode='0021201',proUnitSellAllPrice='240',proUnitSellHalfPrice='240',proUnitSellUnitPrice ='245',proUnitBuyPrice='225',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '212';
UPDATE product SET productName = 'لوحه 12 خط بالعداد مصطفي خليل ', productDescription = '', productCatId = '13', productBuyPrice = '219.3', productSellAllPrice = '230', productSellUnitPrice = '230', productSellHalfPrice = '230', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00212',type ='0', expireDate = '0' , dailyentryId = '243',isService = '0',isOptic = '0',lastbuyprice = '225.00',lastbuyprice_withDiscount = '225',meanbuyprice = '225.00',meanbuyprice_withDiscount = '225' , productbuypricereal = '225' , buypricereal_precentage = '0' , buytotal_precentage = '6.67' , buyhalf_precentage = '6.67' , buypart_precentage = '8.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='225',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='225',meanbuyprice_withTax='225',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='225',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '212';
UPDATE productunit SET unitid = '1', productid = '297', productnumber = '1.00', productunitdate = '2026-09-16', userid = '1', conditions = '0',proUnitParcode='0029701',proUnitSellAllPrice='38',proUnitSellHalfPrice='38',proUnitSellUnitPrice ='40',proUnitBuyPrice='35',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '297';
UPDATE product SET productName = 'جرس عصفوره داخل ', productDescription = '', productCatId = '6', productBuyPrice = '34.5', productSellAllPrice = '38', productSellUnitPrice = '40', productSellHalfPrice = '38', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00297',type ='0', expireDate = '0' , dailyentryId = '348',isService = '0',isOptic = '0',lastbuyprice = '35.00',lastbuyprice_withDiscount = '35',meanbuyprice = '35.00',meanbuyprice_withDiscount = '35' , productbuypricereal = '35' , buypricereal_precentage = '0' , buytotal_precentage = '8.57' , buyhalf_precentage = '8.57' , buypart_precentage = '14.29',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='35',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='35',meanbuyprice_withTax='35',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='35',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '297';
UPDATE productunit SET unitid = '1', productid = '293', productnumber = '1.00', productunitdate = '2026-09-16', userid = '1', conditions = '0',proUnitParcode='0029301',proUnitSellAllPrice='38',proUnitSellHalfPrice='38',proUnitSellUnitPrice ='40',proUnitBuyPrice='35',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '293';
UPDATE product SET productName = 'مشترك ثلاثي ', productDescription = '', productCatId = '24', productBuyPrice = '37.6', productSellAllPrice = '39.5', productSellUnitPrice = '40', productSellHalfPrice = '40', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00293',type ='0', expireDate = '0' , dailyentryId = '344',isService = '0',isOptic = '0',lastbuyprice = '35.00',lastbuyprice_withDiscount = '35',meanbuyprice = '35.00',meanbuyprice_withDiscount = '35' , productbuypricereal = '35' , buypricereal_precentage = '0' , buytotal_precentage = '8.57' , buyhalf_precentage = '8.57' , buypart_precentage = '14.29',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='35',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='35',meanbuyprice_withTax='35',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='35',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '293';
UPDATE productunit SET unitid = '1', productid = '525', productnumber = '1.00', productunitdate = '2026-09-28', userid = '1', conditions = '0',proUnitParcode='0052501',proUnitSellAllPrice='23',proUnitSellHalfPrice='23',proUnitSellUnitPrice ='23',proUnitBuyPrice='20',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '525';
UPDATE product SET productName = 'عازل صيني', productDescription = '', productCatId = '6', productBuyPrice = '22.5', productSellAllPrice = '23', productSellUnitPrice = '23', productSellHalfPrice = '23', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00525',type ='0', expireDate = '0' , dailyentryId = '1020',isService = '0',isOptic = '0',lastbuyprice = '20.00',lastbuyprice_withDiscount = '20',meanbuyprice = '20.00',meanbuyprice_withDiscount = '20' , productbuypricereal = '20' , buypricereal_precentage = '0' , buytotal_precentage = '15' , buyhalf_precentage = '15' , buypart_precentage = '15',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='20',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '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='20',meanbuyprice_withTax='20',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='20',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '525';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 15:09:48";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:39:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-19 18:39:48', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=add'); -- id=4648
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 ('06ad6462bacbce', '2026-10-19 18:32:43', '1', '81528.92', '81528.92', '0', '0', '20075.50',  '20075.50', '20075.5', '0', '1', '2026-10-19 18:39:49', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=61
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 ('00212', '61', '13', '212', '15', '219.3', '3289.50', '0', '', '2026-10-19 18:39:49', '212','','','0','0','0','0','0',null,'219.3','3289.5','0','0','0','0','0','0','0','0','1'); -- id=222
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 212, 0, 0
                    , 219.3, 15, 0, 0, 1, '2026-10-19 18:39:49')
                ON DUPLICATE KEY UPDATE buyprice = 219.3,
                        buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:49' ; -- id=222
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('212', '219.3', '15', '0', 'buyBillController.php', '222', '', '0', '0'); -- id=222
UPDATE product SET  productBuyPrice = "219.3" WHERE productId = 212 ;
UPDATE buybilldetail SET  quantitybefore = 1 WHERE buybilldetailid = 222 ;
UPDATE product SET productName = 'لوحه 12 خط بالعداد مصطفي خليل ', productDescription = '', productCatId = '13', productBuyPrice = '219.30', productSellAllPrice = '230.00', productSellUnitPrice = '230.00', productSellHalfPrice = '230.00', productDate = '2026-09-15', conditions = '0', userId = '1', limitamount = '0', parcode = '00212',type ='0', expireDate = '0' , dailyentryId = '243',isService = '0',isOptic = '0',lastbuyprice = '219.3',lastbuyprice_withDiscount = '219.3',meanbuyprice = '219.66',meanbuyprice_withDiscount = '219.66' , productbuypricereal = '225.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.67' , buyhalf_precentage = '6.67' , buypart_precentage = '8.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='225',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='219.3',meanbuyprice_withTax='219.66',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='219.3',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '212';
UPDATE buybilldetail SET  lastbuyprice = 219.3 , meanbuyprice = 219.66, lastbuyprice_withDiscount = 219.3, meanbuyprice_withDiscount = 219.66
        , lastbuyprice_withTax = 219.3, meanbuyprice_withTax = 219.66, lastbuyprice_withDiscountAndTax = 219.3
                where buybilldetailid = 222;
UPDATE productunit SET proUnitBuyPrice  = 219.3 * productnumber WHERE productid = 212;
UPDATE storedetail SET  productquantity = '16', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '212';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('212', '1', '15', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1', '16', '1', '2026-10-19 18:32:43','0','0'); -- id=4978
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 ('00136', '61', '21', '136', '200', '14.7', '2940.00', '0', '', '2026-10-19 18:39:49', '136','','','0','0','0','0','0',null,'14.7','2940','0','0','0','0','0','0','0','0','1'); -- id=223
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 136, 0, 0
                    , 14.7, 200, 0, 0, 1, '2026-10-19 18:39:50')
                ON DUPLICATE KEY UPDATE buyprice = 14.7,
                        buyQuantity =buyQuantity+200, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:50' ; -- id=223
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('136', '14.7', '200', '0', 'buyBillController.php', '223', '', '0', '0'); -- id=223
UPDATE product SET  productBuyPrice = "14.7" WHERE productId = 136 ;
UPDATE buybilldetail SET  quantitybefore = 57 WHERE buybilldetailid = 223 ;
UPDATE product SET productName = 'شاسيه مفرد ابيض مدور ', productDescription = '', productCatId = '21', productBuyPrice = '14.70', productSellAllPrice = '14.70', productSellUnitPrice = '14.70', productSellHalfPrice = '14.70', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00136',type ='0', expireDate = '0' , dailyentryId = '151',isService = '0',isOptic = '0',lastbuyprice = '14.7',lastbuyprice_withDiscount = '14.7',meanbuyprice = '14.7',meanbuyprice_withDiscount = '14.7' , productbuypricereal = '14.70' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='14.7',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='14.7',meanbuyprice_withTax='14.7',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='14.7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '136';
UPDATE buybilldetail SET  lastbuyprice = 14.7 , meanbuyprice = 14.7, lastbuyprice_withDiscount = 14.7, meanbuyprice_withDiscount = 14.7
        , lastbuyprice_withTax = 14.7, meanbuyprice_withTax = 14.7, lastbuyprice_withDiscountAndTax = 14.7
                where buybilldetailid = 223;
UPDATE productunit SET proUnitBuyPrice  = 14.7 * productnumber WHERE productid = 136;
UPDATE storedetail SET  productquantity = '257', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '136';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('136', '1', '200', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '57', '257', '1', '2026-10-19 18:32:43','0','0'); -- id=4979
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 ('00138', '61', '21', '138', '200', '16.1', '3220.00', '0', '', '2026-10-19 18:39:49', '138','','','0','0','0','0','0',null,'16.1','3220','0','0','0','0','0','0','0','0','1'); -- id=224
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 138, 0, 0
                    , 16.1, 200, 0, 0, 1, '2026-10-19 18:39:51')
                ON DUPLICATE KEY UPDATE buyprice = 16.1,
                        buyQuantity =buyQuantity+200, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:51' ; -- id=224
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('138', '16.1', '200', '0', 'buyBillController.php', '224', '', '0', '0'); -- id=224
UPDATE product SET  productBuyPrice = "16.1" WHERE productId = 138 ;
UPDATE buybilldetail SET  quantitybefore = 373 WHERE buybilldetailid = 224 ;
UPDATE product SET productName = 'شاسيه مفرد اسمر جديد', productDescription = '', productCatId = '21', productBuyPrice = '16.10', productSellAllPrice = '16.10', productSellUnitPrice = '16.70', productSellHalfPrice = '16.10', productDate = '2026-09-14', conditions = '0', userId = '1', limitamount = '0', parcode = '00138',type ='0', expireDate = '0' , dailyentryId = '153',isService = '0',isOptic = '0',lastbuyprice = '16.1',lastbuyprice_withDiscount = '16.1',meanbuyprice = '16.1',meanbuyprice_withDiscount = '16.1' , productbuypricereal = '16.10' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '3.73',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='16.1',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='16.1',meanbuyprice_withTax='16.1',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='16.1',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '138';
UPDATE buybilldetail SET  lastbuyprice = 16.1 , meanbuyprice = 16.1, lastbuyprice_withDiscount = 16.1, meanbuyprice_withDiscount = 16.1
        , lastbuyprice_withTax = 16.1, meanbuyprice_withTax = 16.1, lastbuyprice_withDiscountAndTax = 16.1
                where buybilldetailid = 224;
UPDATE productunit SET proUnitBuyPrice  = 16.1 * productnumber WHERE productid = 138;
UPDATE storedetail SET  productquantity = '573', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '138';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('138', '1', '200', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '373', '573', '1', '2026-10-19 18:32:43','0','0'); -- id=4980
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 ('00564', '61', '21', '564', '300', '14.7', '4410.00', '0', '', '2026-10-19 18:39:49', '564','','','0','0','0','0','0',null,'14.7','4410','0','0','0','0','0','0','0','0','1'); -- id=225
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 564, 0, 0
                    , 14.7, 300, 0, 0, 1, '2026-10-19 18:39:52')
                ON DUPLICATE KEY UPDATE buyprice = 14.7,
                        buyQuantity =buyQuantity+300, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:52' ; -- id=225
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('564', '14.7', '300', '0', 'buyBillController.php', '225', '', '0', '0'); -- id=225
UPDATE product SET  productBuyPrice = "14.7" WHERE productId = 564 ;
UPDATE buybilldetail SET  quantitybefore = 184 WHERE buybilldetailid = 225 ;
UPDATE product SET productName = 'شاسيه مفرد اسمر قديم ', productDescription = '', productCatId = '21', productBuyPrice = '14.70', productSellAllPrice = '15.00', productSellUnitPrice = '16.00', productSellHalfPrice = '16.00', productDate = '2026-10-03', conditions = '0', userId = '1', limitamount = '0', parcode = '00564',type ='0', expireDate = '0' , dailyentryId = '1245',isService = '0',isOptic = '0',lastbuyprice = '14.7',lastbuyprice_withDiscount = '14.7',meanbuyprice = '14.7',meanbuyprice_withDiscount = '14.7' , productbuypricereal = '14.70' , buypricereal_precentage = '0.00' , buytotal_precentage = '2.04' , buyhalf_precentage = '8.84' , buypart_precentage = '8.84',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='14.7',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='14.7',meanbuyprice_withTax='14.7',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='14.7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '564';
UPDATE buybilldetail SET  lastbuyprice = 14.7 , meanbuyprice = 14.7, lastbuyprice_withDiscount = 14.7, meanbuyprice_withDiscount = 14.7
        , lastbuyprice_withTax = 14.7, meanbuyprice_withTax = 14.7, lastbuyprice_withDiscountAndTax = 14.7
                where buybilldetailid = 225;
UPDATE productunit SET proUnitBuyPrice  = 14.7 * productnumber WHERE productid = 564;
UPDATE storedetail SET  productquantity = '484', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '564';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('564', '1', '300', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '184', '484', '1', '2026-10-19 18:32:43','0','0'); -- id=4981
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 ('00298', '61', '6', '298', '30', '53', '1590.00', '0', '', '2026-10-19 18:39:49', '298','','','0','0','0','0','0',null,'53','1590','0','0','0','0','0','0','0','0','1'); -- id=226
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 298, 0, 0
                    , 53, 30, 0, 0, 1, '2026-10-19 18:39:53')
                ON DUPLICATE KEY UPDATE buyprice = 53,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:53' ; -- id=226
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('298', '53', '30', '0', 'buyBillController.php', '226', '', '0', '0'); -- id=226
UPDATE product SET  productBuyPrice = "53" WHERE productId = 298 ;
UPDATE buybilldetail SET  quantitybefore = -2 WHERE buybilldetailid = 226 ;
UPDATE product SET productName = 'جرس خارج بيانو ', productDescription = '', productCatId = '6', productBuyPrice = '53.00', productSellAllPrice = '65.00', productSellUnitPrice = '75.00', productSellHalfPrice = '65.00', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00298',type ='0', expireDate = '0' , dailyentryId = '349',isService = '0',isOptic = '0',lastbuyprice = '53',lastbuyprice_withDiscount = '53',meanbuyprice = '52.5',meanbuyprice_withDiscount = '52.5' , productbuypricereal = '60.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.33' , buyhalf_precentage = '8.33' , buypart_precentage = '25.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='60',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='53',meanbuyprice_withTax='52.5',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='53',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '298';
UPDATE buybilldetail SET  lastbuyprice = 53 , meanbuyprice = 52.5, lastbuyprice_withDiscount = 53, meanbuyprice_withDiscount = 52.5
        , lastbuyprice_withTax = 53, meanbuyprice_withTax = 52.5, lastbuyprice_withDiscountAndTax = 53
                where buybilldetailid = 226;
UPDATE productunit SET proUnitBuyPrice  = 53 * productnumber WHERE productid = 298;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '298';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('298', '1', '30', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-2', '28', '1', '2026-10-19 18:32:43','0','0'); -- id=4982
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 ('00297', '61', '6', '297', '50', '34.5', '1725.00', '0', '', '2026-10-19 18:39:49', '297','','','0','0','0','0','0',null,'34.5','1725','0','0','0','0','0','0','0','0','1'); -- id=227
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 297, 0, 0
                    , 34.5, 50, 0, 0, 1, '2026-10-19 18:39:54')
                ON DUPLICATE KEY UPDATE buyprice = 34.5,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:54' ; -- id=227
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('297', '34.5', '50', '0', 'buyBillController.php', '227', '', '0', '0'); -- id=227
UPDATE product SET  productBuyPrice = "34.5" WHERE productId = 297 ;
UPDATE buybilldetail SET  quantitybefore = 7 WHERE buybilldetailid = 227 ;
UPDATE product SET productName = 'جرس عصفوره داخل ', productDescription = '', productCatId = '6', productBuyPrice = '34.50', productSellAllPrice = '38.00', productSellUnitPrice = '40.00', productSellHalfPrice = '38.00', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00297',type ='0', expireDate = '0' , dailyentryId = '348',isService = '0',isOptic = '0',lastbuyprice = '34.5',lastbuyprice_withDiscount = '34.5',meanbuyprice = '34.56',meanbuyprice_withDiscount = '34.56' , productbuypricereal = '35.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.57' , buyhalf_precentage = '8.57' , buypart_precentage = '14.29',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='35',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='34.5',meanbuyprice_withTax='34.56',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='34.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 = '297';
UPDATE buybilldetail SET  lastbuyprice = 34.5 , meanbuyprice = 34.56, lastbuyprice_withDiscount = 34.5, meanbuyprice_withDiscount = 34.56
        , lastbuyprice_withTax = 34.5, meanbuyprice_withTax = 34.56, lastbuyprice_withDiscountAndTax = 34.5
                where buybilldetailid = 227;
UPDATE productunit SET proUnitBuyPrice  = 34.5 * productnumber WHERE productid = 297;
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '297';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('297', '1', '50', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '7', '57', '1', '2026-10-19 18:32:43','0','0'); -- id=4983
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 ('00293', '61', '24', '293', '20', '37.6', '752.00', '0', '', '2026-10-19 18:39:49', '293','','','0','0','0','0','0',null,'37.6','752','0','0','0','0','0','0','0','0','1'); -- id=228
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 293, 0, 0
                    , 37.6, 20, 0, 0, 1, '2026-10-19 18:39:54')
                ON DUPLICATE KEY UPDATE buyprice = 37.6,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:54' ; -- id=228
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('293', '37.6', '20', '0', 'buyBillController.php', '228', '', '0', '0'); -- id=228
UPDATE product SET  productBuyPrice = "37.6" WHERE productId = 293 ;
UPDATE buybilldetail SET  quantitybefore = 35 WHERE buybilldetailid = 228 ;
UPDATE product SET productName = 'مشترك ثلاثي ', productDescription = '', productCatId = '24', productBuyPrice = '37.60', productSellAllPrice = '39.50', productSellUnitPrice = '40.00', productSellHalfPrice = '40.00', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00293',type ='0', expireDate = '0' , dailyentryId = '344',isService = '0',isOptic = '0',lastbuyprice = '37.6',lastbuyprice_withDiscount = '37.6',meanbuyprice = '35.95',meanbuyprice_withDiscount = '35.95' , productbuypricereal = '35.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '8.57' , buyhalf_precentage = '8.57' , buypart_precentage = '14.29',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='35',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='37.6',meanbuyprice_withTax='35.95',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='37.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '293';
UPDATE buybilldetail SET  lastbuyprice = 37.6 , meanbuyprice = 35.95, lastbuyprice_withDiscount = 37.6, meanbuyprice_withDiscount = 35.95
        , lastbuyprice_withTax = 37.6, meanbuyprice_withTax = 35.95, lastbuyprice_withDiscountAndTax = 37.6
                where buybilldetailid = 228;
UPDATE productunit SET proUnitBuyPrice  = 37.6 * productnumber WHERE productid = 293;
UPDATE storedetail SET  productquantity = '55', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '293';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('293', '1', '20', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '35', '55', '1', '2026-10-19 18:32:43','0','0'); -- id=4984
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 ('00525', '61', '6', '525', '50', '22.5', '1125.00', '0', '', '2026-10-19 18:39:49', '525','','','0','0','0','0','0',null,'22.5','1125','0','0','0','0','0','0','0','0','1'); -- id=229
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 525, 0, 0
                    , 22.5, 50, 0, 0, 1, '2026-10-19 18:39:55')
                ON DUPLICATE KEY UPDATE buyprice = 22.5,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:55' ; -- id=229
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('525', '22.5', '50', '0', 'buyBillController.php', '229', '', '0', '0'); -- id=229
UPDATE product SET  productBuyPrice = "22.5" WHERE productId = 525 ;
UPDATE buybilldetail SET  quantitybefore = 12 WHERE buybilldetailid = 229 ;
UPDATE product SET productName = 'عازل صيني', productDescription = '', productCatId = '6', productBuyPrice = '22.50', productSellAllPrice = '23.00', productSellUnitPrice = '23.00', productSellHalfPrice = '23.00', productDate = '2026-09-28', conditions = '0', userId = '1', limitamount = '0', parcode = '00525',type ='0', expireDate = '0' , dailyentryId = '1020',isService = '0',isOptic = '0',lastbuyprice = '22.5',lastbuyprice_withDiscount = '22.5',meanbuyprice = '22.02',meanbuyprice_withDiscount = '22.02' , productbuypricereal = '20.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '15.00' , buyhalf_precentage = '15.00' , buypart_precentage = '15.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='20',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='22.5',meanbuyprice_withTax='22.02',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='22.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 = '525';
UPDATE buybilldetail SET  lastbuyprice = 22.5 , meanbuyprice = 22.02, lastbuyprice_withDiscount = 22.5, meanbuyprice_withDiscount = 22.02
        , lastbuyprice_withTax = 22.5, meanbuyprice_withTax = 22.02, lastbuyprice_withDiscountAndTax = 22.5
                where buybilldetailid = 229;
UPDATE productunit SET proUnitBuyPrice  = 22.5 * productnumber WHERE productid = 525;
UPDATE storedetail SET  productquantity = '62', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '525';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('525', '1', '50', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '12', '62', '1', '2026-10-19 18:32:43','0','0'); -- id=4985
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00291', '61', '24', '291', '40', '25.6', '1024.00', '0', '', '2026-10-19 18:39:49', '291','','','0','0','0','0','0',null,'25.6','1024','0','0','0','0','0','0','0','0','1'); -- id=230
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-19 18:32:43', 1, 291, 0, 0
                    , 25.6, 40, 0, 0, 1, '2026-10-19 18:39:56')
                ON DUPLICATE KEY UPDATE buyprice = 25.6,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-19 18:39:56' ; -- id=230
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('291', '25.6', '40', '0', 'buyBillController.php', '230', '', '0', '0'); -- id=230
UPDATE product SET  productBuyPrice = "25.6" WHERE productId = 291 ;
UPDATE buybilldetail SET  quantitybefore = 102 WHERE buybilldetailid = 230 ;
UPDATE product SET productName = 'فيشه دكر ', productDescription = '', productCatId = '24', productBuyPrice = '25.60', productSellAllPrice = '26.50', productSellUnitPrice = '28.00', productSellHalfPrice = '26.50', productDate = '2026-09-16', conditions = '0', userId = '1', limitamount = '0', parcode = '00291',type ='0', expireDate = '0' , dailyentryId = '342',isService = '0',isOptic = '0',lastbuyprice = '25.6',lastbuyprice_withDiscount = '25.6',meanbuyprice = '25.32',meanbuyprice_withDiscount = '25.32' , productbuypricereal = '24.80' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.03' , buyhalf_precentage = '4.03' , buypart_precentage = '12.90',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='25.14',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='25.6',meanbuyprice_withTax='25.32',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='25.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '291';
UPDATE buybilldetail SET  lastbuyprice = 25.6 , meanbuyprice = 25.32, lastbuyprice_withDiscount = 25.6, meanbuyprice_withDiscount = 25.32
        , lastbuyprice_withTax = 25.6, meanbuyprice_withTax = 25.32, lastbuyprice_withDiscountAndTax = 25.6
                where buybilldetailid = 230;
UPDATE productunit SET proUnitBuyPrice  = 25.6 * productnumber WHERE productid = 291;
UPDATE storedetail SET  productquantity = '142', userid = '1', storedetaildate = '2026-10-19' WHERE storedetailid = '291';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('291', '1', '40', '0', '61', 'اضافة فاتورة مشتريات', 'buyBillController.php', '102', '142', '1', '2026-10-19 18:32:43','0','0'); -- id=4986
UPDATE supplier SET  suppliercurrentDebt = '81528.92',suppliercurrentDebtInCurrency= '81528.92' , userid = '1', supplierdate = '2026-10-19 18:39:49'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '81528.92', '0', '0', 'اضافة فاتورة مشتريات', '61', '81528.92', '2026-10-19 18:32:43', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','0','1','81528.92','0','81528.92','0',''); -- id=106
UPDATE save SET  savecurrentvalue = '-810867.44',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-790791.94','20075.5', '1', '1', 'اضافة فاتورة مشتريات', '61', '-810867.44', '2026-10-19 18:32:43', '1',  'buyBillController.php','0','','0'); -- id=368
update buybill set dailyentryid='0,0' where buybillid=61;
COMMIT;
UPDATE product SET overAllAveragePrice = 14.7 WHERE productId = 136;UPDATE product SET overAllAveragePrice = 16.1 WHERE productId = 138;UPDATE product SET overAllAveragePrice = 219.3 WHERE productId = 212;UPDATE product SET overAllAveragePrice = 25.24 WHERE productId = 291;UPDATE product SET overAllAveragePrice = 37.6 WHERE productId = 293;UPDATE product SET overAllAveragePrice = 34.5 WHERE productId = 297;UPDATE product SET overAllAveragePrice = 53 WHERE productId = 298;UPDATE product SET overAllAveragePrice = 22.5 WHERE productId = 525;UPDATE product SET overAllAveragePrice = 14.7 WHERE productId = 564;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 15:09:58";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 18:39:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-19 18:39:58', '1', 'editprint', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/buyBillController.php?do=editprint&id=61'); -- id=4649
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 16:08:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 19:38:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 19:38:59', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4650
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:04:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 21:34:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 21:34:16', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4651
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:05:14";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 21:35:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 21:35:15', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4652
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:06:41";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 21:36:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 21:36:41', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4653
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('مفتاح تكييف انيرجي 45 امبير','','6','95','135','135','135','2026-10-19','0','1','0','','0','0','0','0','0','95','95','95','95','95','0','42.11','42.11','42.11','.','0','0','0','95','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','95','95','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','95','0','0','0','0','0','0','','','0','0','0','0'); -- id=610
UPDATE product SET productName = 'مفتاح تكييف انيرجي 45 امبير', productDescription = '', productCatId = '6', productBuyPrice = '95', productSellAllPrice = '135', productSellUnitPrice = '135', productSellHalfPrice = '135', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00610',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '95',lastbuyprice_withDiscount = '95',meanbuyprice = '95',meanbuyprice_withDiscount = '95' , productbuypricereal = '95' , buypricereal_precentage = '0' , buytotal_precentage = '42.11' , buyhalf_precentage = '42.11' , buypart_precentage = '42.11',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='95',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='95',meanbuyprice_withTax='95',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='95',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '610';
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', '610', '1.00', '2026-10-19', '1', '0','0061001','135','135','135','95','','0','0','0','0','0','0','0','0','0','0'); -- id=610
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('610', '1', '1', '1', '2026-10-19'); -- id=610
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('610', '1', '1', '0', '610', 'إضافة منتج', 'productController.php', '0', '1', '1', '2026-10-19','0','0'); -- id=4987
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (610, 1,'2026-10-19 21:36:42',1)
                ON DUPLICATE KEY UPDATE productid = 610, edited = 1, sysdate = '2026-10-19 21:36:42', userid = 1; -- id=822
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '95', '95', '2026-10-19', '1', '0', '0', '2026-10-19 21:36:42','إضافة منتج مفتاح تكييف انيرجي 45 امبير الكمية 1','1','0','0','0','610','productController.php?do=edit&id=610'); -- id=1799
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1799', '382', '95', '','0'); -- id=1815
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2180718.85', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1799', '121', '95', '','0'); -- id=1803
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1851884.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'مفتاح تكييف انيرجي 45 امبير', productDescription = '', productCatId = '6', productBuyPrice = '95.00', productSellAllPrice = '135.00', productSellUnitPrice = '135.00', productSellHalfPrice = '135.00', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00610',type ='0', expireDate = '0' , dailyentryId = '1799',isService = '0',isOptic = '0',lastbuyprice = '95',lastbuyprice_withDiscount = '95',meanbuyprice = '95',meanbuyprice_withDiscount = '95' , productbuypricereal = '95' , buypricereal_precentage = '0' , buytotal_precentage = '42.11' , buyhalf_precentage = '42.11' , buypart_precentage = '42.11',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='95',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='95',meanbuyprice_withTax='95',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='95',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '610';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:06:45";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 21:36:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 21:36:45', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4654
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:07:16";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 21:37:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 21:37:16', '1', 'addAndRetuen', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=4655

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad670b9b9e5d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(47,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-19 21:37:17', '06ad670b9b9e5d', '47', '760.00', '1659', '0', '1', '899.00', '899', '0', '899', '1', '2026-10-19 21:37:17', '', '1', '0', 'يحي غاليه ', '1', '1', '3', '0', 'يحي غاليه ', '40' ,'0','','','','','-1','0','0','0','0','0','899','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-19','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=351
UPDATE client SET  clientdebt = '1659', userid = '1' WHERE clientid = '47';
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 ('47','760.00','899','0','اضافة فاتورة مبيعات','351', '1659', '2026-10-19 21:37:17', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '899', '0', null, '0', null, null,'', '0','1','1','899','1','2026-10-19 21:37:17','0','0','',''); -- id=596
UPDATE client SET  inUse = 0 where clientid = 47;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 208;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,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', '351', '3', '102', '25', '12', '300', '0', '', '1', '2026-10-19 21:37:17', '102', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','208-25,','1','1','0','0','12','300','0','','0','0.00','0','0','0','0'); -- id=2820
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 = 2820;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (102, '2026-10-19', 300, 293.75, 293.75
                    , 293.75, 293.75, 293.75, 293.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 293.75, 293.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+293.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+293.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+293.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+293.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+293.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+293.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+293.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+293.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+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 300, 293.75, 293.75
                    , 293.75, 293.75, 293.75, 293.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 293.75, 293.75, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+293.75
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+293.75, sellCostMeanBuyPrice = sellCostMeanBuyPrice+293.75
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+293.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+293.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+293.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+293.75
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+293.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 = '1360', userid = '1', storedetaildate = '2026-10-19 21:37:18' WHERE storedetailid = '102';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('102', '1', '25', '1', '351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1385', '1360', '1', '2026-10-19 21:37:18','0','0'); -- id=4988
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('13','00190', '351', '20', '190', '4', '15', '60', '0', '', '1', '2026-10-19 21:37:18', '190', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','15','60','0','','0','0.00','0','0','0','0'); -- id=2821
UPDATE sellbilldetail SET  lastbuyprice = 13.00 , meanbuyprice = 13.00, lastbuyprice_withDiscount = 13.00, meanbuyprice_withDiscount = 13.00
        , lastbuyprice_withTax = 13, meanbuyprice_withTax = 13, lastbuyprice_withDiscountAndTax = 13
                where sellbilldetailid = 2821;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (190, '2026-10-19', 60, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 60, 52, 52
                    , 52, 52, 52, 52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 52, 52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+60, sellCostBuyPrice =sellCostBuyPrice+52
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+52, sellCostMeanBuyPrice = sellCostMeanBuyPrice+52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+52, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+52
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+52
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '162', userid = '1', storedetaildate = '2026-10-19 21:37:18' WHERE storedetailid = '190';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('190', '1', '4', '1', '351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '166', '162', '1', '2026-10-19 21:37:18','0','0'); -- id=4989
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 22;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('78.4','00386', '351', '3', '386', '3', '82.5', '247.5', '0', '', '1', '2026-10-19 21:37:18', '386', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','22-3,','1','1','0','0','82.5','247.5','0','','0','0.00','0','0','0','0'); -- id=2822
UPDATE sellbilldetail SET  lastbuyprice = 78.40 , meanbuyprice = 78.40, lastbuyprice_withDiscount = 78.40, meanbuyprice_withDiscount = 78.40
        , lastbuyprice_withTax = 78.4, meanbuyprice_withTax = 78.4, lastbuyprice_withDiscountAndTax = 78.4
                where sellbilldetailid = 2822;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (386, '2026-10-19', 247.5, 235.2, 235.2
                    , 235.2, 235.2, 235.2, 235.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 235.2, 235.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.5, sellCostBuyPrice =sellCostBuyPrice+235.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+235.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+235.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+235.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+235.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+235.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+235.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+235.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+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 247.5, 235.2, 235.2
                    , 235.2, 235.2, 235.2, 235.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 235.2, 235.2, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+247.5, sellCostBuyPrice =sellCostBuyPrice+235.2
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+235.2, sellCostMeanBuyPrice = sellCostMeanBuyPrice+235.2
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+235.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+235.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+235.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+235.2
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+235.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 = '33', userid = '1', storedetaildate = '2026-10-19 21:37:18' WHERE storedetailid = '386';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('386', '1', '3', '1', '351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '33', '1', '2026-10-19 21:37:18','0','0'); -- id=4990
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 200;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('17.6','00100', '351', '3', '100', '6', '17.75', '106.5', '0', '', '1', '2026-10-19 21:37:19', '100', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','200-6,','1','1','0','0','17.75','106.5','0','','0','0.00','0','0','0','0'); -- id=2823
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 = 2823;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (100, '2026-10-19', 106.5, 105.6, 105.6
                    , 105.6, 105.6, 105.6, 105.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 105.6, 105.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+106.5, sellCostBuyPrice =sellCostBuyPrice+105.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 106.5, 105.6, 105.6
                    , 105.6, 105.6, 105.6, 105.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 105.6, 105.6, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+106.5, sellCostBuyPrice =sellCostBuyPrice+105.6
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+105.6, sellCostMeanBuyPrice = sellCostMeanBuyPrice+105.6
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+105.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+105.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+105.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+105.6
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+105.6
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '363', userid = '1', storedetaildate = '2026-10-19 21:37:19' WHERE storedetailid = '100';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('100', '1', '6', '1', '351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '369', '363', '1', '2026-10-19 21:37:19','0','0'); -- id=4991
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('45','00377', '351', '6', '377', '1', '50', '50', '0', '', '1', '2026-10-19 21:37:19', '377', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','50','50','0','','0','0.00','0','0','0','0'); -- id=2824
UPDATE sellbilldetail SET  lastbuyprice = 45.00 , meanbuyprice = 45.00, lastbuyprice_withDiscount = 45.00, meanbuyprice_withDiscount = 45.00
        , lastbuyprice_withTax = 45, meanbuyprice_withTax = 45, lastbuyprice_withDiscountAndTax = 45
                where sellbilldetailid = 2824;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (377, '2026-10-19', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 50, 45, 45
                    , 45, 45, 45, 45
                    , 0, 0, 0, 0
                    , 0, 0, 0, 45, 45, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+50, sellCostBuyPrice =sellCostBuyPrice+45
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+45
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-19 21:37:19' WHERE storedetailid = '377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('377', '1', '1', '1', '351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '32', '1', '2026-10-19 21:37:19','0','0'); -- id=4992
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('95','00342', '351', '6', '342', '1', '135', '135', '0', '', '1', '2026-10-19 21:37:19', '342', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','1','0','','','1','1','0','0','135','135','0','','0','0.00','0','0','0','0'); -- id=2825
UPDATE sellbilldetail SET  lastbuyprice = 95.00 , meanbuyprice = 95.00, lastbuyprice_withDiscount = 95.00, meanbuyprice_withDiscount = 95.00
        , lastbuyprice_withTax = 95, meanbuyprice_withTax = 95, lastbuyprice_withDiscountAndTax = 95
                where sellbilldetailid = 2825;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (342, '2026-10-19', 135, 95, 95
                    , 95, 95, 95, 95
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 95, 95, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+135, sellCostBuyPrice =sellCostBuyPrice+95
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+95, sellCostMeanBuyPrice = sellCostMeanBuyPrice+95
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+95, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+95
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+95
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+95
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+95
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-19', 135, 95, 95
                    , 95, 95, 95, 95
                    , 0, 0, 0, 0
                    , 0, 0, 0, 95, 95, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+135, sellCostBuyPrice =sellCostBuyPrice+95
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+95, sellCostMeanBuyPrice = sellCostMeanBuyPrice+95
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+95, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+95
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+95
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+95
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+95
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-19 21:37:20' WHERE storedetailid = '342';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('342', '1', '1', '1', '351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1', '0', '1', '2026-10-19 21:37:20','0','0'); -- id=4993
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '899', '899', '2026-10-19', '1', '0', '0', '2026-10-19 21:37:20','اضافة فاتورة مبيعات رقم 351','1','0',null,'0','351','sellbillController.php?do=showDetail&sellbillid=351'); -- id=1800
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1800', '480', '899', '','0'); -- id=1816
UPDATE accountstree SET name = 'يحي غاليه ', customName = 'يحي غاليه ', customNameEn = 'يحي غاليه ', nameEn = 'يحي غاليه ', parent = '58', accountNature = '0', theValue = '1659', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 17:10:16' WHERE id = '480';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1800', '143', '899', '','0'); -- id=1804
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '1533827.9', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '826.55', '826.55', '2026-10-19', '1', '0', '0', '2026-10-19 21:37:20','اضافة فاتورة مبيعات رقم 351 - صرف البضاعة من المخزن','1','0',null,'0','351','sellbillController.php?do=showDetail&sellbillid=351'); -- id=1801
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1801', '402', '826.55', '','0'); -- id=1817
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '1369086.3', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1801', '382', '826.55', '','0'); -- id=1805
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2179892.3', 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='1800,0,1801' where sellbillid=351;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-19', 899, 826.55, 826.55
                    , 826.55, 826.55, 826.55, 826.55
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,826.55, 826.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899, sellCostBuyPrice =sellCostBuyPrice+826.55
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+826.55, sellCostMeanBuyPrice = sellCostMeanBuyPrice+826.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+826.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+826.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+826.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+826.55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+826.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 (47, '2026-10-19', 899, 826.55, 826.55
                    , 826.55, 826.55, 826.55, 826.55
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,826.55, 826.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+899, sellCostBuyPrice =sellCostBuyPrice+826.55
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+826.55, sellCostMeanBuyPrice = sellCostMeanBuyPrice+826.55
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+826.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+826.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+826.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+826.55
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+826.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, 899, 826.55, 826.55
                    , 826.55, 826.55, 826.55, 826.55, 826.55, 826.55)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+899, netSellCostBuyPrice = netSellCostBuyPrice+826.55
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+826.55
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+826.55
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+826.55
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+826.55
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+826.55
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+826.55
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+826.55;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad670b9b9e5d and sellbillId = 351 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:07:21";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 21:37:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 21:37:21', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4656
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:39:57";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:09:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:09:57', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4657
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:40:09";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:10:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:10:09', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4658
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:40:24";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:10:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:10:24', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=336'); -- id=4659
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:40:40";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:10:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:10:40', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4660
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:40:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:10:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:10:47', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4661
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:41:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:11:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-19 22:11:12', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php'); -- id=4662
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:41:20";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:11:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-19 22:11:20', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/clientReportsController.php?do=show'); -- id=4663
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:41:47";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:11:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:11:47', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4664
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:41:51";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:11:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 22:11:51', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4665
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:42:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:12:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 22:12:24', '1', 'add', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php?do=add'); -- id=4666
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('لمبه كاسه ويرليس 7 وات 3 سنوات ','','6','39','44','48','44','2026-10-19','0','1','0','','0','0','0','0','0','39','39','39','39','39','0','12.82','12.82','23.08','.','0','0','0','39','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','39','39','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','39','0','0','0','0','0','0','','','0','0','0','0'); -- id=611
UPDATE product SET productName = 'لمبه كاسه ويرليس 7 وات 3 سنوات ', productDescription = '', productCatId = '6', productBuyPrice = '39', productSellAllPrice = '44', productSellUnitPrice = '48', productSellHalfPrice = '44', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00611',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '39',lastbuyprice_withDiscount = '39',meanbuyprice = '39',meanbuyprice_withDiscount = '39' , productbuypricereal = '39' , buypricereal_precentage = '0' , buytotal_precentage = '12.82' , buyhalf_precentage = '12.82' , buypart_precentage = '23.08',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='39',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='39',meanbuyprice_withTax='39',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='39',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '611';
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', '611', '1.00', '2026-10-19', '1', '0','0061101','44','44','48','39','','0','0','0','0','0','0','0','0','0','0'); -- id=611
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('611', '1', '499', '1', '2026-10-19'); -- id=611
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('611', '1', '499', '0', '611', 'إضافة منتج', 'productController.php', '0', '499', '1', '2026-10-19','0','0'); -- id=4994
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (611, 1,'2026-10-19 22:12:25',1)
                ON DUPLICATE KEY UPDATE productid = 611, edited = 1, sysdate = '2026-10-19 22:12:25', userid = 1; -- id=823
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19461', '19461', '2026-10-19', '1', '0', '0', '2026-10-19 22:12:25','إضافة منتج لمبه كاسه ويرليس 7 وات 3 سنوات  الكمية 499','1','0','0','0','611','productController.php?do=edit&id=611'); -- id=1802
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('1802', '382', '19461', '','0'); -- id=1818
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '2199353.3', 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 ('1802', '121', '19461', '','0'); -- id=1806
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '1871345.27', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'لمبه كاسه ويرليس 7 وات 3 سنوات ', productDescription = '', productCatId = '6', productBuyPrice = '39.00', productSellAllPrice = '44.00', productSellUnitPrice = '48.00', productSellHalfPrice = '44.00', productDate = '2026-10-19', conditions = '0', userId = '1', limitamount = '0', parcode = '00611',type ='0', expireDate = '0' , dailyentryId = '1802',isService = '0',isOptic = '0',lastbuyprice = '39',lastbuyprice_withDiscount = '39',meanbuyprice = '39',meanbuyprice_withDiscount = '39' , productbuypricereal = '39' , buypricereal_precentage = '0' , buytotal_precentage = '12.82' , buyhalf_precentage = '12.82' , buypart_precentage = '23.08',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='39',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='39',meanbuyprice_withTax='39',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='39',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '611';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:42:27";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:12:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-19 22:12:28', '1', '', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/productController.php'); -- id=4667
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:42:59";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:12:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:12:59', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4668
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:43:04";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:13:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:13:04', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:43:23";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:13:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:13:23', '1', 'show', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=show'); -- id=4670
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:43:53";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:13:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:13:53', '1', 'editsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=349'); -- id=4671
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-19 18:44:12";
UPDATE user SET loginip = "::1", lastactivetime = "2026-10-19 22:14:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-19 22:14:12', '1', 'addsellBill', '::1', 'DC:4A:3E:84:BB:DA', 'DESKTOP','https://localhost:8080/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=4672
